voxpupuli / puppet-zabbix

Puppet module for creating and maintaining zabbix components with puppet.
https://forge.puppet.com/puppet/zabbix
Apache License 2.0
80 stars 227 forks source link

API not working #111

Closed andreguilhon closed 9 years ago

andreguilhon commented 9 years ago

Hello, I'm using the module to try to configure a Zabbix Server, a Zabbix Agent and import templates. The first two things are done! I can correctly install the Zabbix Server and the Zabbix Agent. I put the manage_resources in the zabbix server declaration, but the Zabbix Agent is not going to the zabbix UI. Also, I cannot import templates, as they don't appear in the UI also. As I'm a (really) newbie in puppet, I'm almos sure I'm doing something wrong. Can you help me? Bellow is my site.pp file contents. Let me know if I should put some other info. Ps. I'm using Ubuntu 14.04 for both server and client, and puppet 3.8.2 on both.

node 'zbxserver.powers.com.br' { class { 'apache': mpm_module => 'prefork', } include apache::mod::php

lass { 'postgresql::server': }

class { 'mysql::server': }

class { 'zabbix': zabbix_url => 'zabbix.zbxserver.powers.com.br', database_type => 'mysql', manage_resources => true, zabbix_api_user => 'Admin', zabbix_api_pass => 'zabbix',

} zabbix::template { '.BS. Firewall - Fortinet': templ_source => 'puppet:///modules/zasdasdabbix/fn.xmdasdasl', }

} node 'zbxagent.powers.com.br' { class { 'zabbix::agent': server => 'zbxserver.powers.com.br', } }

dj-wasabi commented 9 years ago

HI andreguihon,

Thank you for making time to create this issue.

You also have to specify the agent to manage_resources, like this:

node 'zbxagent.powers.com.br' {
  class { 'zabbix::agent':
    server          => 'zbxserver.powers.com.br',
    manage_resource => true,
  }
}

Kind regards, Werner

andreguilhon commented 9 years ago

Thank you for your reply dj-wasabi! I put the manage_resource => true in the node configuration. Ran the puppet agent -t in the node, in the server, both applied successfully, but the node still doesn't show in the hosts list. Also, the template I'm trying to import doesn't import, wich makes me think that I'm missing some configuration in the API part. Is it supposed to work out of the box? Do I need to configure something?

dj-wasabi commented 9 years ago

No, it should work with setting the manage_resources parameter to true on both the agent and server. Which version of the module are you using?

andreguilhon commented 9 years ago

How can I know that? I installed using puppet module install...

Here is the return of the puppet module list:

root@ZbxServer:~# puppet module list /etc/puppet/modules ├── nanliu-staging (v1.0.3) ├── puppetlabs-apache (v1.6.0) ├── puppetlabs-apt (v2.1.1) ├── puppetlabs-concat (v1.2.4) ├── puppetlabs-firewall (v1.7.0) ├── puppetlabs-inifile (v1.4.1) ├── puppetlabs-mysql (v3.6.0) ├── puppetlabs-pe_gem (v0.1.1) ├── puppetlabs-postgresql (v4.5.0) ├── puppetlabs-puppetdb (v5.0.0) ├── puppetlabs-ruby (v0.4.0) ├── puppetlabs-stdlib (v4.7.0) └── wdijkerman-zabbix (v1.5.0)

So I'm guessing I'm on version 1.5.0!

andreguilhon commented 9 years ago

Not a clue on what I'm missing here?

dj-wasabi commented 9 years ago

When adding the parameter manage_resource => true, you did execute an puppet run on the agent and server? You have an correct DNS entry for 'zabbix.zbxserver.powers.com.br' ? Does the puppet run show any errors/messages?

I can't replicate your problem. I have some Ubuntu 14.04 hosts with puppet 3.8.2 with the same wdijkerman-zabbix version (1.5.0) and it all works.

andreguilhon commented 9 years ago

When adding the parameter manage_resource => true, you did execute an puppet run on the agent and server? YES! Several times! You have an correct DNS entry for 'zabbix.zbxserver.powers.com.br' ? I have an entry in the /etc/hosts. This should do the trick, correct? (in both server and agent) Does the puppet run show any errors/messages? NO!

andreguilhon commented 9 years ago

Ok, as you said you have same environment as me and yours works, I rolled back the VM, installed Ubuntu again, on both server and agent and... Nothing, same problem! :( This time I wrote down all the steps, so you can see if I'm missing something:

ON SERVER: wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb dpkg -i puppetlabs-release-precise.deb apt-get update apt-get install puppetmaster apt-get install build-essential apt-get install ruby-dev edit /etc/hosts put all the names needed in it (My DNS server already knows the main names, added only zabbix.zbxagent.powers.com.br) edit /etc/puppet/puppet.conf and put the server=zbxserver.powers.com.br and environmentpath=$confdir/environments mkdir -p /etc/puppet/environments/production/manifests created site.pp in /etc/puppet/environments/production/manifests gem install bundler gem install zabbixapi puppet module install wdijkerman/zabbix /etc/init.d/puppetmaster restart Just to be sure puppet agent -t --debug > /tmp/puppet.log

ON AGENT SIDE vim /etc/hosts (put the zabbix.zbxserver.powers.com.br - just to be sure) wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb dpkg -i puppetlabs-release-precise.deb apt-get update apt-get install puppet vim /etc/puppet/puppet.conf => server=zbxserver.powers.com.br puppet agent -t --debug > /tmp/puppet.log (on server)puppet cert sign zbxagent.powers.com.br puppet agent -t --debug > /tmp/puppet.log (2 times, to be sure) (on server)puppet agent -t --debug > /tmp/puppet.log (2 times, to be sure)

Checked the FrontEnd and the agent is not there yet! Just to be sure, ran the puppet agent -t again, twice on each side, and still nothing. Do you need any other info? Can I help you to help me?

dj-wasabi commented 9 years ago

Have you installed the puppetdb? And have you set this in your /etc/puppet/puppet.conf on your puppet master:

  storeconfigs = true
  storeconfigs_backend = puppetdb
andreguilhon commented 9 years ago

_Have you installed the puppetdb? _ I did not! That must be the problem! I'm trying to configure it now, as soon as it is ok, I'll post my results. Thanks again for the help!

andreguilhon commented 9 years ago

PERFECT! That was the problem! As soon as I configured puppetdb properly, it all worked just fine and out of the box! Thank you very much for your help!