Git Product home page Git Product logo

voxpupuli / puppet-zabbix Goto Github PK

View Code? Open in Web Editor NEW
80.0 48.0 227.0 2.66 MB

Puppet module for creating and maintaining zabbix components with puppet.

Home Page: https://forge.puppet.com/puppet/zabbix

License: Apache License 2.0

Ruby 40.71% Puppet 41.11% HTML 15.95% Shell 2.20% Pascal 0.03%
linux-puppet-module puppet hacktoberfest amazon-puppet-module archlinux-puppet-module centos-puppet-module debian-puppet-module gentoo-puppet-module oraclelinux-puppet-module redhat-puppet-module

puppet-zabbix's Introduction

puppet-zabbix

Build Status Release Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores puppetmodule.info docs Apache-2 License Donated by Werner Dijkerman

Table of Contents

  1. Overview
  2. Upgrade
  3. Module Description - What the module does and why it is useful
  4. Setup - The basics of getting started with the zabbix module
  5. Usage - Configuration options and additional functionality
  6. Reference - An under-the-hood peek at what the module is doing and how
  7. Limitations - OS compatibility, etc.
  8. Development - Contributors
  9. Notes

Overview

This module contains the classes for installing and configuring the following zabbix components:

  • zabbix-server
  • zabbix-agent
  • zabbix-proxy
  • zabbix-javagateway
  • zabbix-sender

This readme will contain all basic information to get you started. Some more information can be found on the github wiki, location: https://github.com/voxpupuli/puppet-zabbix/wiki

Module Description

When using this module, you can monitor your whole environment with zabbix. It can install the various zabbix components like the server and agent, but you will also be able to install specific "userparameter" file which zabbix can use for monitoring.

With the 0.4.0 release, you can - when you have configured exported resources - configure agents and proxies in the webinterface. So when you add an zabbix::agent to an host, it first install the agent onto the host. It will send some data to the puppetdb and when puppet runs on the zabbix-server it will create this new host via the zabbix-api.

Be aware when you have a lot of hosts, it will increase the puppet runtime on the zabbix-server host. It will check via the zabbix-api if hosts exits and costs time.

This module make uses of this gem: https://github.com/express42/zabbixapi With this gem it is possible to create/update hosts/proxy in ruby easy.

Upgrade

1.0.0

With release 1.0.0 the zabbix::server class is split into 3 classes:

  • zabbix::web
  • zabbix::server
  • zabbix::database

Now you can use 3 machines for each purpose. This is something for the bigger environments to spread the load.

When upgrading from 0.x.x to 1.x.x, be aware of the following changes:

  • Choose the correct zabbix setup for your environment *:
    • Single node
    • Multi node
  • Path changes for the database ".done" file. Create the following files in /etc/zabbix/:
    • /etc/zabbix/.schema.done
    • /etc/zabbix/.images.done
    • /etc/zabbix/.data.done
  • Rename of the following parameters:
    • dbtype --> database_type
    • dbhost --> database_host
    • dbuser --> database_user
    • dbpass --> database_password
    • dbschema --> database_schema
    • dbname --> database_name
    • dbsocket --> database_socket
    • dbport --> database_port

* check this document/paragraph how to setup your environment. There were multiple changes to make this work (Like moving parameters to other (new) classes).

In case I missed something, please let me know and will update this document.

2.0.0

Altough this is an major update, there is only one small change that we need to discuss and is specifically for the Zabbix Proxy.

The following properties for the zabbix::proxy needs to have the sizes:

  • vmwarecachesize
  • cachesize
  • historycachesize
  • historytextcachesize

Before 2.0.0 these could be used with an single integer, as in the template was hardcoded the 'M'. With release 2.0.0 you'll have to use the correct full size like: 8M, 16M or 2G.

Setup

As this puppet module contains specific components for zabbix, you'll need to specify which you want to install. Every zabbix component has his own zabbix:: class. Here you'll find each component.

Setup zabbix-server

This will install an basic zabbix-server instance. You'll have to decide if you want to run everything on a single host or multiple hosts. When installing on a single host, the 'zabbix' class can be used. When you want to use more than 1 host, you'll need the following classes:

  • zabbix::web
  • zabbix::server
  • zabbix::database

You can see at "usage" in this documentation how all of this can be achieved.

You will need to supply one parameter: zabbix_url. This is the url on which the zabbix instance will be available. With the example at "setup", the zabbix webinterface will be: http://zabbix.example.com.

When installed succesfully, zabbix web interface will be accessable and you can login with the default credentials:

Username: Admin Password: zabbix

Usage

The following will provide an basic usage of the zabbix components.

Usage zabbix-server

The zabbix-server can be used in 2 ways:

  • one node setup
  • multiple node setup.

The following is an example for using the PostgreSQL as database:

node 'zabbix.example.com' {
  class { 'apache':
    mpm_module => 'prefork',
  }

  class { 'zabbix':
    zabbix_url    => 'zabbix.example.com',
  }
}

When you want to make use of an MySQL database as backend:

node 'zabbix.example.com' {
  class { 'apache':
    mpm_module => 'prefork',
  }

  class { 'zabbix':
    zabbix_url    => 'zabbix.example.com',
    database_type => 'mysql',
  }
}

Everything will be installed on the same server. There is also an possibility to seperate the components, please check the following wiki: https://github.com/voxpupuli/puppet-zabbix/wiki/Multi-node-Zabbix-Server-setup

Please note that if you use apache as the frontend (which is the default) and SELinux is enabled, you need to set these SEBooleans (preferably in a profile) to allow apache to connect to the database:

if $facts['selinux'] {
  selboolean { ['httpd_can_network_connect', 'httpd_can_network_connect_db']:
    persistent => true,
    value      => 'on',
  }
}

Usage zabbix-agent

Basic one way of setup, wheter it is monitored by zabbix-server or zabbix-proxy:

class { 'zabbix::agent':
  server => '192.168.20.11',
}

To install on Windows without requiring the use of chocolatey:

$tmpdir = $facts['windows_env']['TMP'];

download_file { 'get zabbix-installer.msi':
  url                   => "https://<hostname>/zabbix_agent-${zabbix_version}-windows-amd64-openssl.msi",
  destination_directory => $tmpdir,
  destination_file      => "zabbix_agent-windows-amd64-openssl.msi",
}

class { 'zabbix::agent':
  zabbix_version          => $zabbix_version,
  manage_resources        => true,
  manage_choco            => false,
  zabbix_package_agent    => "Zabbix Agent (64-bit)",
  zabbix_package_state    => present,
  zabbix_package_provider => 'windows',
  zabbix_package_source   => "${tmpdir}/zabbix_agent-windows-amd64-openssl.msi",
}

Usage zabbix-agent2

Basic one way of setup, wheter it is monitored by zabbix-server or zabbix-proxy:

class { 'zabbix::agent':
  agent_configfile_path => '/etc/zabbix/zabbix_agent2.conf',
  include_dir           => '/etc/zabbix/zabbix_agent2.d',
  include_dir_purge     => false,
  zabbix_package_agent  => 'zabbix-agent2',
  servicename           => 'zabbix-agent2',
  manage_startup_script => false,
  server                => '192.168.20.11',
}

Note manage_startup_script => false was mandatory to run agent2 in module version 10.x.x

Usage zabbix-proxy

Like the zabbix-server, the zabbix-proxy can also be used in 2 ways:

  • single node
  • multiple node

The following is an example for using the PostgreSQL as database:

node 'proxy.example.com' {
  class { 'zabbix::database':
    database_type => 'postgresql',
  }

  class { 'zabbix::proxy':
    zabbix_server_host => '192.168.20.11',
    database_type      => 'postgresql',
  }
}

When you want to make use of an MySQL database as backend:

node 'proxy.example.com' {
  class { 'zabbix::database':
    database_type => 'mysql',
  }

  class { 'zabbix::proxy':
    zabbix_server_host => '192.168.20.11',
    database_type      => 'mysql',
  }
}

When you want to make use of an sqlite database as backend:

class { 'zabbix::proxy':
  zabbix_server_host => 'zabbix.example.com',
  database_type      => 'sqlite',
  database_name      => '/tmp/database',
}

You'll have to specify the location to the file in the database_name parameter. Zabbix should have write access to the file/directory.

Everything will be installed on the same server. There is also an possibility to seperate the components, please check the following wiki: https://github.com/voxpupuli/puppet-zabbix/wiki/Multi-node-Zabbix-Proxy-setup

Usage zabbix-javagateway

The zabbix-javagateway can be used with an zabbix-server or zabbix-proxy. You'll need to install it on an server. (Can be together with zabbix-server or zabbix-proxy, you can even install it on a sperate machine.). The following example shows you to use it on a seperate machine.

node 'server05.example.com' {
# My ip: 192.168.20.15
  class { 'zabbix::javagateway': }
}

When installed on seperate machine, the zabbix::server configuration should be updated by adding the javagateway parameter.

node 'server01.example.com' {
  class { 'zabbix::server':
    zabbix_url  => 'zabbix.example.com',
    javagateway => '192.168.20.15',
  }
}

Or when using with an zabbix-proxy:

node 'server11.example.com' {
  class { 'zabbix::proxy':
    zabbix_server_host => '192.168.20.11',
    javagateway        => '192.168.20.15',
  }
}

Usage zabbix-sender

The zabbix-sender installation is quite simple and straightforward:

include zabbix::sender

Usage zabbix-userparameters

Using an 'source' file:

zabbix::userparameters { 'mysql':
  source => 'puppet:///modules/zabbix/mysqld.conf',
}

Or for example when you have just one entry:

zabbix::userparameters { 'mysql':
  content => 'UserParameter=mysql.ping,mysqladmin -uroot ping | grep -c alive',
}

Using an LLD 'script' file:

zabbix::userparameters { 'lld_snort.sh':
  script => 'puppet:///modules/zabbix/lld_snort.sh',
}

When you are using Hiera or The Foreman, you can use it like this:

---
classes:
  zabbix::userparameter:
    data:
      mongo:
        source: puppet:///modules/zabbix/mongo.conf

Content of the mongo.conf:

UserParameter=mongo.coll.count[*],echo "db.setSlaveOk();db.getCollection('$1').count()" | /opt/mongo/bin/mongo processor | sed -n 3p
UserParameter=mongo.db.queries,echo "db.currentOp().inprog.length" | /opt/mongo/bin/mongo processor | sed -n 3p

Screenshot from The Foreman (With thanks to "inspired-geek" ) image

When running the puppet-agent command, it will install the mongo.conf file on the host.

Usage zabbix-template

With the 'zabbix::template' define, you can install Zabbix templates via the API. You'll have to make sure you store the XML file somewere on your puppet server or in your module.

Please be aware that you can only make use of this feature when you have configured the module to make use of exported resources.

You can install the MySQL template xml via the next example:

zabbix::template { 'Template App MySQL':
  templ_source => 'puppet:///modules/zabbix/MySQL.xml'
}

zabbix::template class accepts zabbix_version parameter, by default is set to module's default Zabbix version. Please override if you are using a different version.

zabbix::template { 'Template App MySQL':
  templ_source   => 'puppet:///modules/zabbix/MySQL.xml',
  zabbix_version => '5.2'
}

Zabbix Upgrades

It is possible to do upgrades via this module. An example for the zabbix agent:

class{'zabbix::agent':
  zabbix_version => '2.4',
  manage_repo    => true,
}

This will install the latest zabbix 2.4 agent for you. The module won't to any upgrades nor install patch releases. If you want to get patch releases automatically:

class{'zabbix::agent':
  zabbix_version       => '2.4',
  manage_repo          => true,
  zabbix_package_state => 'latest',
}

Let's asume zabbix just released version 3.4. Than you can do upgrades as follow:

class{'zabbix::agent':
  zabbix_version       => '3.4',
  manage_repo          => true,
  zabbix_package_state => 'latest',
}

You can also tell the module to only create the new repository, but not to update the existing agent:

class{'zabbix::agent':
  zabbix_version       => '3.4',
  manage_repo          => true,
  zabbix_package_state => 'installed',
}

Last but not least you can disable the repo management completely, which will than install zabbix from the present system repos:

class{'zabbix::agent':
  manage_repo          => false,
  zabbix_package_state => 'present',
}

Even in this scenario you can do automatic upgrades via the module (it is the job of the user to somehow bring updates into the repo, for example by managing the repo on their own):

class{'zabbix::agent':
  manage_repo          => false,
  zabbix_package_state => 'latest',
}

Reference

Take a look at the REFERENCE.md.

Limitations

This module supports Zabbix 5.0, 6.0 and 7.0. The upstream supported versions are documented here Please have a look into the metadata.json for all supported operating systems.

This module is supported on both the community and the Enterprise version of Puppet.

Please be aware, that when manage_resources is enabled, it can increase an puppet run on the zabbix-server a lot when you have a lot of hosts.

Contributors

Take a look at the CONTRIBUTING.md

Contributors List:

Note

Standard usage

  • Not specified as required but for working correctly, the epel repository should be available for the 'fping'|'fping6' packages.
  • Make sure you have sudo installed and configured with: !requiretty.

SE Linux

On systems with SE Linux active and enforcing, Zabbix agent will be limited unless given proper rights with an SE Linux module. This Puppet module will apply some default SE Linux rules for it. More can be provided if needed by using two class parameters, for example in Hiera YAML:

zabbix::agent::selinux_require:
  - 'type zabbix_agent_t'
  - 'class process setrlimit'
zabbix::agent::selinux_rules:
  zabbix_agent_t:
    - 'allow zabbix_agent_t self:process setrlimit'
  zabbix_script_t:
    - 'allow zabbix_script_t zabbix_agent_t:process sigchld'

When using exported resources

At the moment of writing, the puppet run will fail one or more times when manage_resources is set to true when you install an fresh Zabbix server. It is an issue and I'm aware of it. Don't know yet how to solve this, but someone suggested to try puppet stages and for know I haven't made it work yet.

  • Please be aware, that when manage_resources is enabled, it can increase an puppet run on the zabbix-server a lot when you have a lot of hosts. You also need to ensure that you've got ruby installed on your machine, and related packages to compile native extensions for gems (usually gcc and make).
  • First run of puppet on the zabbix-server can result in this error:
Error: Could not run Puppet configuration client: cannot load such file -- zabbixapi
Error: Could not run: can't convert Puppet::Util::Log into Integer

See: http://comments.gmane.org/gmane.comp.sysutils.puppet.user/47508, comment: Jeff McCune | 20 Nov 20:42 2012

This specific issue is a chicken and egg problem where by a provider needs a gem, but the catalog run itself is the thing that provides the gem dependency. That is to say, even in Puppet 3.0 where we delay loading all of the providers until after pluginsync finishes, the catalog run hasn't yet installed the gem when the provider is loaded.

The reason I think this is basically a very specific incarnation of #6907 is because that ticket is pretty specific from a product functionality perspective, "You should not have to run puppet twice to use a provider."

After another puppet run, it will run succesfully.

  • On a Red Hat family server, the 2nd run will sometimes go into error:
Could not evaluate: Connection refused - connect(2)

When running puppet again (for 3rd time) everything goes fine.

Transfer Notice

This plugin was originally authored by Werner Dijkerman. The maintainer preferred that Vox Pupuli take ownership of the module for future improvement and maintenance. Existing pull requests and issues were transferred over, please fork and continue to contribute at https://github.com/voxpupuli/puppet-zabbix

Previously: https://github.com/dj-wasabi/puppet-zabbix

puppet-zabbix's People

Contributors

alexjfisher avatar bastelfreak avatar baurmatt avatar dhollinger avatar dhoppe avatar dj-wasabi avatar ekohl avatar ericsysmin avatar evgeni avatar fraenki avatar frozenfoxx avatar heidistein avatar igalic avatar itler avatar juniorsysadmin avatar jyaworski avatar karolisc avatar kenyon avatar lordievader avatar lucas42 avatar ordnaxz avatar rnelson0 avatar root-expert avatar smortex avatar teluq-pbrideau avatar valantin avatar wyardley avatar yevtushenko avatar zilchms avatar zv0n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-zabbix's Issues

Zabbix-proxy install database population

The database population script for the zabbix-proxy-mysql package is run with the command below:

command => "cd ${schema_path} && mysql -h '${database_host}' -u '${database_user}' -p'${database_password}' -D '${database_name}' < schema.sql && touch /etc/zabbix/.schema.done",

Because the schema.sql is gzipped into schema.sql.gz on Ubuntu 14.04 LTS, the command fails.
It should be altered with a small if-loop that checks if the file is gzipped:

command => "cd ${schema_path} && if [ -f schema.sql.gz ]; then gunzip schema.sql.gz ; fi && mysql -h '${database_host}' -u '${database_user}' -p'${database_password}' -D '${database_name}' < schema.sql && touch /etc/zabbix/.schema.done",

new web instance

Debian 7
puppetlabs/postgresql v4.3.0
wdijkerman/zabbix v1.4.0

Creation of a new web instance fail with following message :

Info: /Stage[main]/Zabbix::Server/Service[zabbix-server]: Unscheduling refresh on Service[zabbix-server]
Error: Could not set 'present' on ensure: No such file or directory - /etc/zabbix/web/zabbix.conf.php20150525-14233-2ute18.lock at 216:/etc/puppet/modules/zabbix/manifests/web.pp
Error: Could not set 'present' on ensure: No such file or directory - /etc/zabbix/web/zabbix.conf.php20150525-14233-2ute18.lock at 216:/etc/puppet/modules/zabbix/manifests/web.pp
Wrapped exception:
No such file or directory - /etc/zabbix/web/zabbix.conf.php20150525-14233-2ute18.lock
Error: /Stage[main]/Zabbix::Web/File[/etc/zabbix/web/zabbix.conf.php]/ensure: change from absent to present failed: Could not set 'present' on ensure: No such file or directory - /etc/zabbix/web/zabbix.conf.php20150525-14233-2ute18.lock at 216:/etc/puppet/modules/zabbix/manifests/web.pp

This fail because /etc/zabbix does not contain any "web" directory.

Split Zabbix Server Class into Components

The Zabbix Server class, as is currently defined in the wdijkerman-zabbix module, could actually be split into the 3 components:

  • Zabbix Server
  • Zabbix WebUI
  • Zabbix DB

In order to scale zabbix effectively, it's best practice to run each of these components on separate nodes.

(for example, http://blog.zabbix.com/scalable-zabbix-lessons-on-hitting-9400-nvps/2615/)

As it stands, it does not seem possible to use the wdijkerman-zabbix module to install the zabbix server on one node, the WebUI on a second, and the Database on a third.

Apt-key error in Ubuntu 14.04

In Ubuntu 14.04 we get this error every Puppet run:

Warning: /Apt_key[Add key: 79EA5ED4 from Apt::Source zabbix]: The id should be a full fingerprint (40 characters), see README.

The fingerprint should be:
Key fingerprint = FBAB D5FB 2025 5ECA B22E E194 D13D 58E4 79EA 5ED4

Invalid parameter group_create

Hi,

With the new 1.5.0 version I've this error message :

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter group_create on Zabbix_host[zabbix0.lan.xxxx] at /etc/puppet/modules/zabbix/manifests/resources/agent.pp:27 on node zabbix0.lan.xxxx
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

To temporarily avoid this I've to comment /etc/puppet/modules/zabbix/manifests/resources/agent.pp:32.

I've never wrote any puppet type but as far as I can see ./lib/puppet/provider/zabbix_host/ruby.rb and ./lib/puppet/type/zabbix_host.rb seems to be ok with this new feature ...

" Using allow is not supported in your Apache version"

When deploying "zabbix::web" on a stand alone server or on a monolithic server I get the following error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template apache/vhost/_directories.erb:
Filepath: /opt/puppet/lib/ruby/site_ruby/1.9.1/puppet/parser/functions/fail.rb
Line: 3
Detail: Apache::Vhost: Using allow is not supported in your Apache version
at /etc/puppetlabs/puppet/environments/production/modules/apache/manifests/vhost.pp:545 on node zabbix-web.streetlightdata.net
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

All other modules (including "zabbix::database" and "zabbix::server) deploy without issues.

Setup is as follows (all instances running in google cloud):

Newly build puppet enterprise server [3.7.3 (Puppet Enterprise 3.7.1)]

Newly build zabbix server. Installed zabbix module with "puppet module install wdijkerman-zabbix"

Class: apache
mpm_module = "prefork"

Class: apache::mod::php

Class: zabbix::web
zabbix_url = "zabbix-web.test.net"

Invalid parameter key_source on Apt::Source[zabbix] at /etc/puppet/environments/myenv/modules/zabbix/manifests/repo.pp:144 on node XXXXX

I'm having an interesting error.

According to the docs I don't need to add anything more than:

class { 'zabbix::agent':
server => 'ipaddress',
}

which I did.

Here is the code snippet:

  'ubuntu' : {
    apt::source { 'zabbix':
      location   => "http://repo.zabbix.com/zabbix/${zabbix_version}/ubuntu/",
      release    => $ubuntu,
      repos      => 'main',
      key        => 'FBABD5FB20255ECAB22EE194D13D58E479EA5ED4',
      key_source => 'http://repo.zabbix.com/zabbix-official-repo.key',
    }
  • my version is 1.5.0
  • I'm using ubuntu
  • I'm using puppetlabs/apt 2.0.1 which I think is the root of the problem.

Are you using an "old" apt::source definition?

David Thornton

new postgresql instance

puppetlabs/postgresql v4.3.0
wdijkerman/zabbix v1.4.0

Creation of a new postgresql instance fail with following message :

Notice: /Stage[main]/Zabbix::Database/Postgresql::Server::Db[zabbix_server]/Postgresql::Server::Database[zabbix_server]/Exec[/usr/lib/postgresql/9.1/bin/createdb --port='5432' --owner='' --template=template0  'zabbix_server']/returns:                                               ^
Error: /Stage[main]/Zabbix::Database/Postgresql::Server::Db[zabbix_server]/Postgresql::Server::Database[zabbix_server]/Exec[/usr/lib/postgresql/9.1/bin/createdb --port='5432' --owner='' --template=template0  'zabbix_server']: Failed to call refresh: /usr/lib/postgresql/9.1/bin/createdb --port='5432' --owner='' --template=template0  'zabbix_server' returned 1 instead of one of [0]
Error: /Stage[main]/Zabbix::Database/Postgresql::Server::Db[zabbix_server]/Postgresql::Server::Database[zabbix_server]/Exec[/usr/lib/postgresql/9.1/bin/createdb --port='5432' --owner='' --template=template0  'zabbix_server']: /usr/lib/postgresql/9.1/bin/createdb --port='5432' --owner='' --template=template0  'zabbix_server' returned 1 instead of one of [0]

This is due to --owner=''.

To avoid this I edit manifests/database.pp:130 to change

        postgresql::server::db { $database_name:
          user     => $database_user,
          password => postgresql_password($database_user, $database_password),
          require  => Class['postgresql::server'],
        }

to

        postgresql::server::db { $database_name:
          user     => $database_user,
          owner    => $database_user,
          password => postgresql_password($database_user, $database_password),
          require  => Class['postgresql::server'],
        }

And thanks for your job ;)

Cannot install on Jessie

Installing latest version from forge does not work now that jessie has released. I see in repo.pp there is a workaround to map "sid" to wheezy but now that jessie has been released the os version is being reported as 8.0 and I get this error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: This is an unsupported operating system (Debian 8.0) at /etc/puppet/modules/zabbix/manifests/repo.pp:70

"Cannot Load Such File -- zabbixapi" despite installation

Version Information

OS: RHEL 6
Puppet Master: 3.7.4
Puppet Agent: 3.7.4

Manifest

node 'ZABBIXMASTER' {
  file { '/etc/yum.conf':
    source => 'puppet:///modules/yum/yum.conf',
    owner  => root,
    group  => root,
  }
  class { 'apache':
    mpm_module    => 'prefork',
  }
  include apache::mod::php
  class { 'mysql::server': }
  class { 'zabbix':
    zabbix_url      => 'ZABBIXMASTER',
    database_type   => 'mysql',
    zabbix_api_user => 'Admin',
    zabbix_api_pass => 'HIDDEN',
    manage_resources => true,
  }
  class { 'zabbix::agent':
    server => 'ZABBIXMASTER',
  }
}

node 'EXAMPLENODE' {
  class { 'zabbix::agent':
    server => 'c0007329.itcs.hp.com',
    manage_resources => true,
  }

Issue:

Puppet complains that neither bundler or zabbixapi are installed in logs.

The Zabbix module reports this should resolve after a maximum of 3 runs. Issue did not resolve itself after more than 3 runs.

https://forge.puppetlabs.com/wdijkerman/zabbix/readme#when-using-exported-resources

Attempted Resolution:

Installed bundler and zabbixapi gems on the Zabbix Master server.

gem install bundler 
gem install zabbixapi

Result:

After running puppet agent --test on Zabbix Master the following errors are reported.

[root@nope zabbix]# puppet agent --test
Info: Retrieving plugin
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/win_common_desktop_directory.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/apt_update_last_success.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/pe_puppetdb_server_status.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/concat_basedir.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/puppi_projects.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/last_run.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/platform_tag.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/pe_postgres_default_version.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/custom_auth_conf.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/facter_dot_d.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/root_home.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/ip6tables_version.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/puppet_vardir.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/pe_build.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/windows_common_appdata.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/iptables_persistent_version.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/gemhome.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/apt_updates.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/iptables_version.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/staging_http_get.rb
Info: Loading facts in /var/opt/lib/pe-puppet/lib/facter/windows.rb
Info: Caching catalog for c2t06545.itcs.hp.com
Info: Applying configuration version '1424201871'
Error: Could not run Puppet configuration client: cannot load such file -- zabbixapi
Error: Could not run: can't convert Puppet::Util::Log into Integer

manage_repo false still installs repo

Using wdijkerman-zabbix-1.0.0, when manage_repo in zabbix::server is false, zabbix::repo is still required (and installs the repos).
This is because of the following: -

Installing the packages

package { "zabbix-server-${db}":
ensure => $zabbix_package_state,
require => Class['zabbix::repo'],
}

zabbix::repo doest not inherit zabbix::params

If zabbix::repo is used outside of zabbix::server, zabbix::params is not inherited, in such case default param values are not well resolved :

class zabbix::repo(
  $manage_repo    = $zabbix::params::manage_repo,
  $zabbix_version = $zabbix::params::zabbix_version,
) {

$manage_repo & $zabbix_version are undefined.

This need occurs when apt configuration is done in a different stage than other job. My case (stage first is done before main)

  class {'::zabbix::repo':
    stage           =>  'first',
    manage_repo     =>  true,
    zabbix_version  =>  '2.4',
  }
  ...
  class {'::zabbix':
    zabbix_url      => 'zabbix.domain.tld',
    manage_firewall => true,
    manage_repo     => false,
    database_type   => 'postgresql',
  }

when i don't specify manage_repo & zabbix_version, ::zabbix::repo does nothing.

So, is it possible that zabbix::repo inherits zabbix::params to enable default values ?

Module fails with future parser enabled

Hi Werner,

The module fails then future parser is enabled in puppet.conf

Errors:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Left match operand must result in a String value. Got an Object. at /etc/puppet/environments/production/modules/zabbix/manifests/agent.pp:207:7

and

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Left match operand must result in a String value. Got an Object. at /etc/puppet/environments/production/modules/zabbix/manifests/proxy.pp:305:7

The root cause is this check
if ($listenip =~ /^(eth|bond).*/) {
in proxy.pp and agent.pp

more info https://tickets.puppetlabs.com/i#browse/PUP-1782

I don't use listenip so i overcome it with
if ($listenip != undef ) {

Karolis

Bad syntax in manifests/proxy.pp

In forge.puppetlabs repository
casesize instead of cachesize
check comments we have to use this param in MB not in B
for example, just pust 32 if you want 32M in CacheSize value

how use zabbix::userparams ?

Hi,

I use zabbix::userparams in node definition like that:
node test {
include zabbix::agent
zabbix::userparams { 'mysql.conf':
content => 'UserParameter=mysql.ping,mysqladmin -uroot ping | grep -c alive',
}

and when run puppet aggent -t got error:
Error: Could not apply complete catalog: Found 1 dependency cycle:
(File[/mysql.conf.conf] => Service[zabbix-agent] => File[/mysql.conf.conf])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz

I try use zabbix:userparams without inslude zabbix::agent, but got error:

Error: Failed to apply catalog: Could not find dependency Service[zabbix-agent] for File[/mysql.conf.conf] at /etc/puppet/modules/zabbix/manifests/userparameters.pp:60

How use this to work correctly ?

zabbix_version ignored

On params.pp:

$zabbix_version = '2.4'

On my manifest

class { '::zabbix::agent':
  zabbix_version => '2.2',
}

This results in zabbix-agent 2.4 installed

This can be easily fixed passing zabbix_version to class repo in agent.pp:

if $manage_repo {
  #include zabbix::repo
  class { 'zabbix::repo':
    zabbix_version => $zabbix_version,
  }
  Package['zabbix-agent'] {require => Class['zabbix::repo']}
}

Exactly same issue on proxy.pp and very likely server.pp.

You can not configure hostname in zabbix::proxy

When I declare the proxy hostname by class, for example:

class { 'zabbix::proxy':
zabbix_package_state => 'latest',
hostname => 'proxy.domain.com',
database_host => 'localhost',
database_type => 'mysql',
manage_database => false,
database_name => 'zabbix_proxy',
database_user => 'zabbix',
database_password => 'zabbix',
zabbix_server_host => 'server.domain.com',
database_socket => '/var/lib/mysql/mysql.sock',
database_port => '3306',
offlinebuffer => '8',
logfile => '/var/log/zabbix/zabbix_proxy.log',
logfilesize => '0',
zabbix_server_port => '10051',
pidfile => '/var/run/zabbix/zabbix_proxy.pid',
}

the hostname is not set in zabbix_proxy.conf file, but the server FQDN.

That would work correct?

I'm using:
Centos 6.6
Zabbix Agent 2.4
Zabbix Proxy 2.4
Puppet 3.7.4

Thank you

Could not evaluate: uninitialized constant Puppet::Provider::Zabbix::ZabbixApi

Hi,

I've got a dedicated node for zabbix-server, postgres and zabbix-web:

class profiles::zabbixweb {
  class {'::zabbix::web':
    manage_vhost          => false,
    zabbix_timezone       => 'Europe/Berlin',
    manage_resources      => true,
    database_host         => '192.168.0.12',
    database_name         => 'zabbix',
    database_user         => 'zabbix',
    database_password     => 'password',
    zabbix_server         => '192.168.0.9',
    zabbix_api_user       => 'Admin',
    zabbix_api_pass       => 'password',
    zabbix_package_state  => 'latest',
    zabbix_version        => '2.4',
  }
}
class profiles::postgresqlserver {
  class { 'postgresql::globals':
    encoding            => 'UTF-8',
    locale              => 'en_US.UTF-8',
    manage_package_repo => true,
    version             => '9.4',
  }-> 
  class { '::postgresql::server':
    listen_addresses  => $::ipaddress_eth1,
    ipv4acls          => ['host zabbix zabbix 192.168.0.9/32 md5'],
  }
  postgresql::server::db { 'zabbix':
    user     => 'zabbix',
    password => postgresql_password('zabbix', 'password'),
  }
}
class profiles::zabbixserver {
  class {'::postgresql::globals':
    encoding            => 'UTF-8',
    locale              => 'en_US.UTF-8',
    manage_package_repo => true,
    version             => '9.4',
  }->
  class {'::postgresql::client': }
  class {'::zabbix::server':
    zabbix_version    => '2.2',
    database_host     => '192.168.0.12',
    database_name     => 'zabbix',
    database_user     => 'zabbix',
    database_password => 'password',
  }
}

in addition, the agent is running on every node:

  class { '::zabbix::agent':
    server                => 'myserver',
    zabbix_package_state  => 'latest',
    zabbix_version        => '2.4',
    manage_resources      => true,
  }

puppetdb is running fine, storeconfigs is also working. Puppet runs fine on every node except for the zabbix web node (I get the error for every node that runs the agent):

Error: /Stage[main]/Zabbix::Resources::Web/Zabbix_host[my-database]: Could not evaluate: uninitialized constant Puppet::Provider::Zabbix::ZabbixApi

Every machine is running Debian 8 with Puppet 3.8.1. Do you have any ideas?

Debian repo key cannot be validated by apt module

==> prov: Error: validate_re(): "FBABD5FB20255ECAB22EE194D13D58E479EA5ED4" does not match ["\\A(0x)?[0-9a-fA-F]{8}\\Z", "\\A(0x)?[0-9a-fA-F]{16}\\Z"] at /tmp/vagrant-puppet-2/modules-0/apt/manifests/key.pp:60 on node prov.dev.local
==> prov: Error: validate_re(): "FBABD5FB20255ECAB22EE194D13D58E479EA5ED4" does not match ["\\A(0x)?[0-9a-fA-F]{8}\\Z", "\\A(0x)?[0-9a-fA-F]{16}\\Z"] at /tmp/vagrant-puppet-2/modules-0/apt/manifests/key.pp:60 on node prov.dev.local

I suppose there is new validation in apt module which supposes that key must be 8 or 16 syblols long.

If i remember correctly it is possible to add keys by last key in chain.

Using zabbix-server with theforeman

I'm trying out your module in combination with foreman and got a little problem which I can't seem to solve.
I followed the readme but had problems. Had to include postgresql::server and apache together with zabbix::server and set zabbix_url. In the end I got things working but if I now add a class to this kind of server I get the error that apache::mod::php requires apache::mod::prefork. Adding that leads to a duplicate definition :-(
Is there a way to debug this somewhat more then only looking at the messages from puppet?
As far as I can see everything should work but puppetwise it doesn't. The zabbix server does work.

Regards,

Joop

Firewall and server domain name

Hi,
i have an issue when I try to put domain name in zabbix::agent for the parameter server and or serveractive.

Indeed, in manifests/agent.pp we have this code for the firewall :

# Manage firewall
if $manage_firewall {
  firewall { '150 zabbix-agent':
    dport  => $listenport,
    proto  => 'tcp',
    action => 'accept',
    source => "${server}/24",
    state  => ['NEW','RELATED', 'ESTABLISHED'],
 }

Here my code :

# Zabbix
 class { 'zabbix::agent':
         zabbix_version => '2.2.6',
         server => 'example.com',
         serveractive => 'example.com',
         hostname => 'test_puppet',
         manage_firewall => true,
 }
 zabbix::userparameters { 'raid_default':
         source => 'puppet:///modules/zabbix/raid0_test.conf.erb',
 }

The /24 doesn't work on debian 7 (wheezy).
I have this error with puppet agent -v --test --debug command.

Error: Failed to apply catalog: Parameter source failed on Firewall[150 zabbix-agent]: host_to_ip failed for example.fr/24, exception no address for example.com//24 at /etc/puppet/modules/zabbix/manifests/agent.pp:292
Wrapped exception:
host_to_ip failed for example.com/24, exception no address for parc.tec6.fr/24

Can you make a change for resolv this unfotunetly problem please ?

Thanks for you super project !

Zabbix-proxy

Hi again,
Is it possible to change the hostname in the zabbix-proxy configuration file?
I don't found how to do that.
Something like that zabbix::proxy::hostname: 'My_Custom_Name'

Regards.

Zabbix proxy and hiera

Hi,
I have now problem with zabbix-proxy and use of hiera.
Indeed, i receive this error Error: Failed to apply catalog: Validation of Exec[ --port='' --owner='' --template=template0 'zabbix-proxy'] failed: ' --port='' --owner='' --template=template0 'zabbix-proxy'' is not qualified and no path was specified. Please qualify the command or specify a path. at /etc/puppet/modules/postgresql/manifests/server/database.pp:63 Wrapped exception: ' --port='' --owner='' --template=template0 'zabbix-proxy'' is not qualified and no path was specified. Please qualify the command or specify a path.

I use this configuration :

zabbix::proxy::zabbix_server_host: 'xxx.com'
zabbix::proxy::database_type: 'mysql'
zabbix::proxy::zabbix_server_port: '10051'

I have also tried to add this configuration :

zabbix::database::database_type: 'mysql'
zabbix::database::zabbiix_type: 'proxy'
zabbix::database::database_name: 'zabbix-proxy'
zabbix::database::database_user: 'zabbix-proxy'
zabbix::database::database_password: 'test'

But I have got this error Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Class[Zabbix::Database] is already declared; cannot redeclare at /etc/puppet/modules/zabbix/manifests/proxy.pp:408 on node teliboxexpress.local.tec6.net Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Have you an idea to what I doing wrong ?

Thank you and have a nice day ;)

failure if zabbix hostgroup does not exist

If a node specifies a hostgroup that does not exist the following failure occurs.

Error: Could not set 'present' on ensure: Server answer API error:
 {
  "code": -32500,
  "message": "Application error.",
  "data": "No permissions to referred object or it does not exist!"
}
 on request:
 {
  "method": "host.create",
  "params": [
    {
      "host": "cent7test.example.edu",
      "interfaces": [
        {
          "type": 1,
          "main": 1,
          "ip": "",
          "dns": "cent7test.example.edu",
          "port": "10050",
          "useip": 0
        }
      ],
      "status": 0,
      "available": 1,
      "groups": [
        {
          "groupid": null
        }
      ],
      "proxy_hostid": null,
      "templates": [
        10001,
        10102
      ]
    }
  ],
  "id": 80395,
  "jsonrpc": "2.0",
  "auth": "ae774e8c6af9b0790929ab1019109332"
} at 37:/etc/puppet/environments/feature_zabbix_agent/modules/zabbix/manifests/resources/agent.pp
Error: Could not set 'present' on ensure: Server answer API error:
 {
  "code": -32500,
  "message": "Application error.",
  "data": "No permissions to referred object or it does not exist!"
}
 on request:
 {
  "method": "host.create",
  "params": [
    {
      "host": "cent7test.example.edu",
      "interfaces": [
        {
          "type": 1,
          "main": 1,
          "ip": "",
          "dns": "cent7test.example.edu",
          "port": "10050",
          "useip": 0
        }
      ],
      "status": 0,
      "available": 1,
      "groups": [
        {
          "groupid": null
        }
      ],
      "proxy_hostid": null,
      "templates": [
        10001,
        10102
      ]
    }
  ],
  "id": 80395,
  "jsonrpc": "2.0",
  "auth": "ae774e8c6af9b0790929ab1019109332"
} at 37:/etc/puppet/environments/feature_zabbix_agent/modules/zabbix/manifests/resources/agent.pp
Wrapped exception:
Server answer API error:
 {
  "code": -32500,
  "message": "Application error.",
  "data": "No permissions to referred object or it does not exist!"
}
 on request:
 {
  "method": "host.create",
  "params": [
    {
      "host": "cent7test.example.edu",
      "interfaces": [
        {
          "type": 1,
          "main": 1,
          "ip": "",
          "dns": "cent7test.example.edu",
          "port": "10050",
          "useip": 0
        }
      ],
      "status": 0,
      "available": 1,
      "groups": [
        {
          "groupid": null
        }
      ],
      "proxy_hostid": null,
      "templates": [
        10001,
        10102
      ]
    }
  ],
  "id": 80395,
  "jsonrpc": "2.0",
  "auth": "ae774e8c6af9b0790929ab1019109332"
}
Error: /Stage[main]/Zabbix::Resources::Agent/Zabbix_host[cent7test.example.edu]/ensure: change from absent to present failed: Could not set 'present' on ensure: Server answer API error:
 {
  "code": -32500,
  "message": "Application error.",
  "data": "No permissions to referred object or it does not exist!"
}
 on request:
 {
  "method": "host.create",
  "params": [
    {
      "host": "cent7test.example.edu",
      "interfaces": [
        {
          "type": 1,
          "main": 1,
          "ip": "",
          "dns": "cent7test.example.edu",
          "port": "10050",
          "useip": 0
        }
      ],
      "status": 0,
      "available": 1,
      "groups": [
        {
          "groupid": null
        }
      ],
      "proxy_hostid": null,
      "templates": [
        10001,
        10102
      ]
    }
  ],
  "id": 80395,
  "jsonrpc": "2.0",
  "auth": "ae774e8c6af9b0790929ab1019109332"
} at 37:/etc/puppet/environments/feature_zabbix_agent/modules/zabbix/manifests/resources/agent.pp

userparameter in hiera

Hello,

I've installed your puppet module in my environment. I'm using exported_resources and my nodes are automatically added to zabbix thanks to your module.
I'm following the instructions in https://github.com/dj-wasabi/puppet-zabbix#usage-zabbix-userparameters and configured some userparemeters in hiera:

zabbix::userparameter::data:
    DiskIO_userparameters:
    source: 'puppet:///modules/zabbix/diskio.conf'
    template: 'DiskIO'

But the userparameter is not copied to the client.

I've hardcoded manage_reosurces=true in the module.

If I call it as zabbix:userparameters:

zabbix::userparameters { 'diskIO' :
    source   => 'puppet:///modules/zabbix/diskio.conf',
    template => 'DiskIO',
}

It works as expected.

So, at this point I'm not sure if I faced a bug in the zabbix/hiera usage or in the doc or something wrong in my code.

Am I doing something wrong? Do you have any working example?

Many thanks for your great work in this module.

Cheers,
A

Unable to create host with zabbixapi - Invalid params

I'm having a problem with exported resources. I've configured the following class on a server

class { '::zabbix::agent':
    agent_use_ip       => false,
   zabbix_version     => '2.4',
   server             => 'host.test.com',
   manage_resources   => true,
   manage_repo        => true,
   manage_firewall    => true,
   zbx_group          => 'Linux servers',
   zbx_templates      => ['C_Linux_base'],
   logfilesize        => '10',
   monitored_by_proxy => '',
}

But when running puppet on the zabbix server I get the following error:

Wrapped exception:
Server answer API error:
 {
  "data": "Incorrect arguments passed to function.",
  "code": -32602,
  "message": "Invalid params."
}
 on request:
 {
  "params": [
    {
      "available": 1,
      "interfaces": [
        {
          "dns": "host.test.com",
          "main": 1,
          "type": 1,
          "useip": 0,
          "port": "10050",
          "ip": null
        }
      ],
      "status": 0,
      "proxy_hostid": null,
      "host": "host.test.com",
      "templates": [
        10056
      ],
      "groups": [
        {
          "groupid": 6
        }
      ]
    }
  ],
  "jsonrpc": "2.0",
  "method": "host.create",
  "auth": "341c3fbe85ke0ed60a1c15a560ab27ec",
  "id": 10965
}

Looking at the Zabbix API docs it does look like the template array should be in the format "templateid": "20045", is this the problem?

Any help would be much appreciated.

Parametrise script folder

It would be nice to give users possibility to select where they would like scripts to be installed.
Could you, please, parametrise script folder like ${include_dir} for user parameters?
Thank you.

zabbixapi gem not loaded when using ruby1.8

If I enable manage_resources in zabbix::server on a machine running ruby 1.8.7, I get the following error:

err: Could not run Puppet configuration client: no such file to load -- zabbixapi

(I'm using debian, and puppet seems to have a hardcoded dependency on ruby 1.8, despite ruby 1.9.3 also being installed on the system.)

Do you intend this module to work with ruby 1.8.7, or only newer versions?

Need to overide php_values

Hi,

I want to increase memory_limit for zabbix vhost. I suppose that below default should be overwritten in zabbix::web where apache::vhost type is defined

custom_fragment => "
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1

Set correct timezone

php_value date.timezone ${zabbix_timezone}",

But I seems stuck, since I need to do it via hiera.

I tried this but no luck

zabbix::web:
zabbix_vhost:
php_values:
memory_limit: 256

How it can be changed?

Thanks
Sergey

zabbixapi gem fails to install (ubuntu 14.04)

Hi Werner,

After enabling manage_resources zabbixapi gem fails to install.

Error 1:
`require': no such file to load -- mkmf (LoadError)
from extconf.rb:36

Error 2:
Error: Could not update: Execution of '/usr/bin/gem install -v 2.4.0 --no-rdoc --no-ri zabbixapi' returned 1: Building native extensions. This could take a while...
ERROR: Error installing zabbixapi:
ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb

creating Makefile

make
sh: 1: make: not found

The module misses these packages:
sudo apt-get install ruby1.9.1-dev
sudo apt-get install build-essential

manage_firewall is set to 'false' by default

As per documentation it says "manage_firewall: Wheter you want to manage the firewall. If true (Which is default), iptables will be configured to allow communications to zabbix ports."

However 'manage_firewall' is set to 'false' in params.pp file. I had to manually set it to 'true' to get it working. Either documentation should be updated or params.pp should be modified so that manage_firewall is default to 'true.
Thanks

Unable to install version 2.2

Good day.

After updating from 1.0.0 version to 1.3.0 I'm no longer able to install zabbix agent version 2.2.
I've researched and found following commit that changed installation behaviour.

e542992

I'm using Foreman with this module. Can you please assist how to force v2.2?

Thanks,
Mikhail.

Module expects postgresql to be install on same machine

I've had trouble attempting to use this module with postgresql on another machine.

class { 'zabbix::server':
  zabbix_url => 'zabbix.example.com',
  dbhost     => '10.0.0.2',
}

(Where the machine at 10.0.0.2 is already set up running postgresql).

I get the following types of puppet errors:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid relationship: Postgresql_psql[Check for existence of db 'zabbix-server'] { require => Class[Postgresql::Server::Service] }, because Class[Postgresql::Server::Service] doesn't seem to be in the catalog

And

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid relationship: Postgresql_psql[CREATE ROLE "zabbix-server" ENCRYPTED PASSWORD '**redacted**' LOGIN NOCREATEROLE NOCREATEDB NOSUPERUSER  CONNECTION LIMIT -1] { require => Class[Postgresql::Server] }, because Class[Postgresql::Server] doesn't seem to be in the catalog

This is because the module has require statements which reference the postgreqsl classes, assuming they're going to be on the same machine. If I add include postgresql::server to my manifest, then the errors go away. (But then I end up postgresql configured on the localhost, not remotely)

Support sqLite db for proxies

Hello, and thank you for this Puppet module, it's quite excellent. I have run into an issue with proxy configuration, however. Proxies support use of sqLite for the dbtype in Zabbix, and it looks like there is mention of this in your docs also:

https://github.com/dj-wasabi/puppet-zabbix/blob/master/manifests/proxy.pp#L11

[dbtype]

Type of database. Can use the following 3 databases:

- postgresql

- mysql

- sqlite

However, setting the dbtype to `sqlite' seems to fail with the following error:

Error: Unrecognized database type for proxy: sqlite at /etc/puppet/modules/zabbix/manifests/proxy.pp:295

Farther down in the proxy manifest, it looks like there is no case switch to set `sqlite' as an option for the dbtype:

https://github.com/dj-wasabi/puppet-zabbix/blob/master/manifests/proxy.pp#L286

Use the correct db.

case $dbtype {
'postgresql': {
$db = 'pgsql'
}
'mysql': {
$db = 'mysql'
}
default: {
fail("Unrecognized database type for proxy: ${dbtype}")
}
}

Is this an option that can be fully implemented at some point? Thank you.

allow setting location of psql

The path for psql in zabbix::database::postgresql is: -
/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

I have it installed in /opt/postgres/9.3/bin.
Can we have a parameter to set the path for non-standard.

I can create a symlink, but it seems a shame that it's necessary.

File extensions of Userparameters scripts

Hi Werner,

I started moving userparameters into hiera. Maybe would be nice to control extensions of script files after they being landing to target server:
file { "${script_dir}/${name}"

Now all scripts end up without any extensions. But it might be tricky to realize though

Regards
Sergey

Add dependency on apt

Today I've tried to update from 0.5.1 to 1.3.0 and got an error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: validate_re(): "FBABD5FB20255ECAB22EE194D13D58E479EA5ED4" does not match ["\\A(0x)?[0-9a-fA-F]{8}\\Z", "\\A(0x)?[0-9a-fA-F]{16}\\Z"] at /etc/puppet/environments/zabbix_update/modules/apt/manifests/key.pp:60 on node vagrant-ubuntu-precise-64
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Found, that you've updated keys in 32adbb8, but my apt module was of version 1.6.0.
Could you, please, add dependency on apt module, so it would be easier to update later?
Thank you!

zabbix.conf.php.erb wrong zbx name

This template contains the following line:

$ZBX_SERVER = '<%= @dbhost %>';

This causes the web interface to look to the database server for the zabbix-server which is not always the case.

This can be fixed by changing the line to:

$ZBX_SERVER = '<%= @fqdn %>';

Sorry i cannot make a pull request for this one.

Love the module, keep up the good work mate.

Multi-node setup: manage_resources invalid on Class[Zabbix::Server]

Documentation reports that "manage_resources" should be available to the following

zabbix::server, zabbix::proxy & zabbix::agent

Using manage_resources on zabbix::server returns an error

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter manage_resources on Class[Zabbix::Server] at /etc/puppetlabs/puppet/environments/production/manifests/zabbix.pp:41 on node HOSTNAME
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Puppet code used

 class { 'zabbix::server':
    database_host  => 'HOSTNAME',
    database_type  => 'mysql',
    manage_resources => true,
  }

module installation fails

Good day.

Faced strange issue. Tried to debug it:

# puppet module install wdijkerman-zabbix -d
Debug: Runtime environment: puppet_version=3.7.0, ruby_version=1.8.7, run_mode=user
Notice: Preparing to install into /etc/puppet/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=wdijkerman-zabbix
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-apache
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-apache&limit=20&offset=20
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-firewall
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-firewall&limit=20&offset=20
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-stdlib
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-stdlib&limit=20&offset=20
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-concat
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=ripienaar-concat
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-postgresql
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-postgresql&limit=20&offset=20
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-apt
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-mysql
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=puppetlabs-mysql&limit=20&offset=20
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/releases?module=bodepd-create_resources
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Info: Resolving dependencies ...
Info: Preparing to install ...
Debug: HTTP GET https://forgeapi.puppetlabs.com/v3/files/wdijkerman-zabbix-0.4.1.tar.gz
Debug: Failed to load library 'pe_license' for feature 'pe_license'
Debug: Executing 'gzip -dc /var/lib/puppet/puppet-module/cache/wdijkerman-zabbix20140918-29480-rt697-0 | tar xof -'
Debug: Executing 'find . -type d -exec chmod 755 {} +'
Debug: Executing 'find . -type f -exec chmod a-wst {} +'
Debug: Executing 'chown -R 0:0 .'
Error: No such file or directory - /var/lib/puppet/puppet-module/cache/tmp-unpacker20140918-29480-1wwook3/zabbix
Error: Try 'puppet help module install' for usage

I'm using foreman(maybe this will help).
For now I've managed to install module by repacking it and creating symlink: zabbix -> wdijkerman-zabbix-0.4.1

Thanks,
Mikhail.

Multi-node Setup: Web class does not properly configure database port

"database_port" is not properly set when web node is split from master node.

Puppet code:


# Zabbix Web Node

node 'MASTER' {
  file { '/etc/yum.conf':
    source => 'puppet:///modules/yum/yum.conf',
    owner  => root,
    group  => root,
  }
  class { 'apache':
      mpm_module => 'prefork',
  }
  class { 'apache::mod::php': }
  class { 'zabbix::web':
    zabbix_url      => '',
    zabbix_server   => 'MASTER',
    database_host   => 'MASTER',
    zabbix_api_user => 'whatever',
    zabbix_api_pass => 'crazysecurepassword',
    database_type   => 'mysql',
  }
}

Output:

/etc/zabbix/web/zabbix.conf.php

<?php
// Zabbix GUI configuration file
global $DB;

$DB['TYPE']     = 'MYSQL';
$DB['SERVER']   = 'c2t06545.itcs.hp.com';
$DB['PORT']     = '0';
$DB['DATABASE'] = 'zabbix_server';
$DB['USER']     = 'zabbix_server';
$DB['PASSWORD'] = 'zabbix_server';

// SCHEMA is relevant only for IBM_DB2 database
$DB['SCHEMA'] = '';

$ZBX_SERVER      = 'c2t06545.itcs.hp.com';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'c2t06545.itcs.hp.com';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
?>

Wrong mpm, missing php module on ubuntu 14.04

Hi,
Module fails to install on ubuntu 14.04. The errors:

..........
Notice: /Stage[main]/Apache/File[/etc/apache2/mods-enabled/php5.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/apache2/mods-enabled/php5.load]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/apache2/mods-enabled/authn_core.load]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/apache2/mods-enabled/status.load]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/apache2/mods-enabled/mpm_prefork.load]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/apache2/mods-enabled/status.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/apache2/mods-enabled/mpm_prefork.conf]/ensure: removed
...........
Error: /Stage[main]/Apache::Service/Service[httpd]: Failed to call refresh: Could not start Service[httpd]: Execution of '/etc/init.d/apache2 start' returned 1: * Starting web server apache2
*

  • The apache2 configtest failed.
    Output of config test was:
    AH00526: Syntax error on line 63 of /etc/apache2/sites-enabled/25-zabbix.test.conf:
    Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
    Action 'configtest' failed.
    The Apache error log may have more information.
    Error: /Stage[main]/Apache::Service/Service[httpd]: Could not start Service[httpd]: Execution of '/etc/init.d/apache2 start' returned 1: * Starting web server apache2

puppet apache module removes php module because it is not in the ubuntu default module list.

another error:

Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install zabbix-frontend-php' returned 100: Reading package lists...

Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
Action 'configtest' failed.
The Apache error log may have more information.
apache2_reload: Your configuration is broken. Not restarting Apache 2

  • Restarting web server apache2
    ...fail!
  • The apache2 configtest failed.
    Output of config test was:
    AH00534: apache2: Configuration error: More than one MPM loaded.

puppet apache module disables mpm_event but not the default ubuntu one - mpm_worker

To make the zabbix module to work I added this to my zabbix node's manifest:
    class { 'apache':
        mpm_module => 'prefork',
    }
    include apache::mod::php

Karolis

Incorrectly initiated mysql/postgresql server class

Hi Werner,

You have added to documentation:
class { 'postgresql': }

class { 'mysql': }

I get the errors:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: ERRO R: This class has been deprecated and the functionality moved
into mysql::server. If you run mysql::server without correctly calling
mysql:: server with the new override_options hash syntax you will revert
your MySQL to the stock settings. Do not proceed without removing this
class and using mysql::server correctly.

https://github.com/karolisc/puppet-zabbix/commit/50099a3562a6f12c057decfeae1a210d8fd327bd

btw. could you add some comment on db too?

Karolis

Add support for SSL sites

It would be great to support SSL sites when managing the Apache vhost. Also, the new provider which connects to the zabbix api has the url protocol hard coded:
:url => "http://#{zabbix_url}/api_jsonrpc.php",

setting Hostname and HostnameItem causes a warning on agentd start

Hostname and HostnameItem are both set by default, this leads into this warning:

Shutting down Zabbix agent: [ OK ]
Starting Zabbix agent: zabbix_agentd [3912]: Warning: both Hostname and HostnameItem defined, using [xxx]

HostnameItem should not set by default, and Hostname should be disabled when HostnameItem is set

listenip bug

Found a typo, probably relating to atleast agent.pp listenip.
The following code block has its comparison backwards:

Find if listenip is set. If not, we can set to specific ip or

to network name. If more than 1 interfaces are available, we

can find the ipaddress of this specific interface if listenip

is set to for example "eth1" or "bond0.73".

if $listenip == undefined {
if ($listenip =~ /^(eth|bond|lxc).*/) {
$int_name = "ipaddress_${listenip}"
$listen_ip = inline_template('<%= scope.lookupvar(int_name) %>')
} elsif is_ip_address($listenip) {
$listen_ip = $listenip
} else {
$listen_ip = $::ipaddress
}
} else {
$listen_ip = $::ipaddress
}

It should be:

Find if listenip is set. If not, we can set to specific ip or

to network name. If more than 1 interfaces are available, we

can find the ipaddress of this specific interface if listenip

is set to for example "eth1" or "bond0.73".

if $listenip != undefined {
if ($listenip =~ /^(eth|bond|lxc).*/) {
$int_name = "ipaddress_${listenip}"
$listen_ip = inline_template('<%= scope.lookupvar(int_name) %>')
} elsif is_ip_address($listenip) {
$listen_ip = $listenip
} else {
$listen_ip = $::ipaddress
}
} else {
$listen_ip = $::ipaddress
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.