Transferred puppet module wdijkerman-zabbix to voxpupuli

Zabbix LogoPuppet Logo

After 2 years of developing, 25 releases, 78 forks and +35000 downloads of the Puppet module for installing and maintaining Zabbix, I’ve decided to move the module to the guys at Vox Pupuli. As my focus lately is towards other tools as Ansible and Docker, I don’t have any time anymore to keep my Puppet knowledge up2date. The last half year (or maybe little bit longer) I only could accept Pull Requests and do some minor changes, anything else would cost me a lot of time to figure it out how things would work in Puppet.

With transferring the module to the guys at Vox Pupuli, I would say the module will be in very good hands. (Well, some of those guys provided a lot of Pull Requests to improve the CI part of the Module.. 🙂 )

@Vox Pupuli: Good luck and hopefully you could improve it a lot more! 🙂

wdijkerman-zabbix 2.1.0 puppet module just released

Puppet Logo Zabbix Logo

I just released an new version of the wdijkerman-zabbix puppet module: 2.0.0.

This release was possible with the huge efforts that @rnelson0 made for this module. Did fixed some bugs, tests and made it possible to use travis-ci.org to validate the builds. When an Pull Request is created by someone, the PR will be build on travis-ci too! 🙂

The change log for this release:

  • Removed a debug entry #156 (By pull request: hkumarmk (Thanks!))
  • Add Puppet Forge Version and Downloads badges #163 (By pull request: rnelson0 (Thanks!))
  • Travis CI setup: ensure all rspec tests pass #162 (By pull request: rnelson0 (Thanks!))
  • Update proxy.pp, fix Error: …install zabbix-proxy- .. #159 (By pull request: subkowlex (Thanks!))
  • Puppetgem #158 (By pull request: rnelson0 (Thanks!))

The “#<NUM>” is a reference to an Github issue. The release can now also be found on and downloaded from the forge.

If you find an bug or have an improvement for this Zabbix puppet module, please create pull requests!

wdijkerman-zabbix 2.0.0 puppet module just released

Puppet LogoZabbix Logo

I just released an new version of the wdijkerman-zabbix puppet module: 2.0.0.

This release will contain a lot of Pull Requests, bug fixes and some new features. This release also works with Puppet 4. (Probably also with earlier versions, but first time I tested it work Puppet 4).

The change log for this release:

  • wdijkerman-zabbix works with puppet 4
  • Fix for: Server and Proxy templates are inconsistent #144
  • fixed SSL server template options for 2.2 #141 (By pull request: IceBear2k (Thanks!))
  • fix syntax error #139 (By pull request: mkrakowitzer (Thanks!))
  • Allow agent to listen on * #138 (By pull request: ekohl (Thanks!))
  • enable apache_php_max_input_vars #137 (By pull request: bastelfreak (Thanks!))
  • Fix typo in zabbix-userparameters reference #136 (By pull request: sgnl05 (Thanks!))
  • Listen on all IPs #133 (By pull request: z3rogate (Thanks!))
  • tap0 or tun0 (OpenVPN interfaces) interface as listenip #132 (By pull request: z3rogate (Thanks!))
  • fixed typo for comment mysql #145 (By pull request: eander210 (Thanks!))
  • Updated the listen_ip for proxy so it same as for agent.
  • allow serveractive to be optional #146 (By pull request: ericsysmin (Thanks!))
  • Allow agent_serveractive value to be blank #147 (By pull request: ericsysmin (Thanks!))
  • Added support for adding LDAP certificate location to Zabbix Web. Upd… #150 (By pull request: elricsfate (Thanks!))
  • Added zabbix_template_host type #154 (By pull request: hkumarmk (Thanks!))
  • Type to manage zabbix application #155 (By pull request: hkumarmk (Thanks!))

The “#<NUM>” is a reference to an Github issue. The release can now also be found on and downloaded from the forge.

If you find an bug or have an improvement for this Zabbix puppet module, please create pull requests!

Extending the Ansible Test Kitchen tests with BATS tests

ansible_logo_black_square

In one of the previous blog posts (This one) I described how you can test your Ansible roles with Test Kitchen and Serverspec. With this setup we were able to execute an Ansible Role in an docker container and validate this installation with Serverspec. Server spec is a little bit limited, as we only tested the installation in an sort of technical way: Process is running, port is open, file is created and owner by user x etc. Sometimes this isn’t enough to validate your setup, BATS is the answer.

“Bats is a TAP-compliant testing framework for Bash. It provides a simple way to verify that the UNIX programs you write behave as expected.
A Bats test file is a Bash script with special syntax for defining test cases. Under the hood, each test case is just a function with a description.”
So how does this look like? Let dive in this example:
#!/usr/bin/env bats

@test "Validate status code for login page" {
  run curl -s -o /dev/null -w "%{http_code}" http://zabbix.example.com/index.php
  [[ $output = "200" ]]
}

First we let the script now this is an bats script. The 2nd line is the start of an test and this line starts with the @ sign. Each test has an description and in this case: Validate status code for login page.  Next line is the actual test, we run the curl command. The command needs to start with run, so it will know that an actual command should be executed. In this case, the output of the curl command is the http status code and this will be checked in the 4th line. The $output variable contains the output of the command and in this case, it will contain 200 (or something else, but then the test fails.)

We can also do an check to find if some string is found in the output of the test command, see the following example:

@test "Validate login page and search for \"Username\"" {
  run curl -s http://zabbix.example.com/index.php
  [[ $output =~ ">Username<" ]]
}

With this test, we do an curl of an page and checks if we can find the string “>Username<“ in the output. If this is found, this test is executed correctly, otherwise it will fail.

Just to be clear, you don’t have to use this output check for each check. You can also rely on the exit codes of the command. See this paragraph:

“Test cases consist of standard shell commands. Bats makes use of Bash’s errexit (set -e) option when running test cases. If every command in the test case exits with a 0 status code (success), the test passes. In this way, each line is an assertion of truth.”

(Source: https://github.com/sstephenson/bats)

Please check the github page, there are some nice examples on how to write your tests. But the goal for this blog post is that we have to use it with our Test Kitchen setup, so how do we continue?

As you might recall from the earlier mentioned blog post, we created the directory structure: test/integrations/default. And in this directory we created an directory named serverspec. In this “default” directory we also create an directory named bats. After this we create the file with the extension .bats.

Now we are all set. 😃Now we can execute “kitchen test” and when the Ansible role is installed, the bats suits will begin:

-----> Running bats test suite
        ✓ Validate status code for login page
        ✓ Validate login page and search for "Username"
        ✓ Validate if we can login with default credentials via API

Above example shows 3 tests and each test is executed correctly, as you can see with the checks in front of it. (Otherwise we would see an ‘x’) Right after this, the server spec will be executed.

Have fun! 😃

Installing zabbix-server with ansible

ansible_logo_black_squarezabbix_logo

Not only I have an puppet module which can be freely used from the forge, I also have some Ansible roles for Zabbix. This page will describe installing the zabbix-server with the dj-wasabi.zabbix-server role. If you want to know how you install the zabbix-agent, please check this page.

You can find the role and some information on this page: https://galaxy.ansible.com/list#/roles/2070

This role works on the 3 main Linux operating systems:

  • RedHat
  • Debian
  • Ubuntu

So, if your server has one of these operating system, you can continue. If you have however an other operating system and have some Ansible knowledge, please add some improvements and create an Pull Request on Github. I always accept Pull Requests related to the Ansible roles.

When you want to install this role, you only have to execute the following command:

ansible-galaxy install dj-wasabi.zabbix-server

Now we need to setup everything, but before we do anything we need to know what kind of database server is going to be used. Zabbix Server can work with several different databases as backend. This Ansible role only works with the following databases:

  • PostgreSQL
  • MySQL

Before we see the examples, there is one main parameter which is always needed: zabbix_url

This is the url on which the zabbix interface is available and should be an fqdn. Default it will create an Apache Virtual Host configuration file with this FQDN as ServerName. If you set this parameter as this:

zabbix_url: zabbix.example.com

the web interface will be available at: http://zabbix.example.com

PostgreSQL

Default the PostgreSQL is used as backend and before we can use this role, we need to find and download an Ansible role for PostgreSQL which can be used on your operating system. In this example we are using the following role: ‘galaxyprojectdotorg.postgresql’

The following is an example of an playbook for installing the ‘zabbix-server’ with an PostgreSQL database:

--- 
- hosts: zabbix-server
  roles: 
    - role: galaxyprojectdotorg.postgresql
      postgresql_pg_hba_conf: 
        - "host all all 127.0.0.1/32 trust"
        - "host all all ::1/128 trust"
      postgresql_pg_hba_local_ipv4: false
      postgresql_pg_hba_local_ipv6: false
    - role: dj-wasabi.zabbix-server
      zabbix_url: zabbix.example.com
      zabbix_version: 2.4
      server_dbuser: zabbix-server
      server_dbpassword: zabbix-server

This is the minimum configuration to use for this role with an PostgreSQL as database. What might help to secure everything is to use an more difficult to guess password for the ‘server_dbuser’ 😉

MySQL

Lets use MySQL as backend now. The following example is used with the following role: ‘geerlingguy.mysql’:

---
- hosts: localhost
  roles:
    - role: geerlingguy.mysql
    - role: ansible-zabbix-server
      zabbix_url: zabbix.example.com
      zabbix_version: 2.4
      database_type: mysql
      database_type_long: mysql
      server_dbuser: zabbix-server
      server_dbpassword: zabbix-server

Same as for the example with PostgreSQL, use an different value for the server_dbpassword.

Other configurations

Don’t think that what you just saw with configuring this role is everything. There are a lot of other configuration parameters that can be set. Keep in mind, that all configuration options you’ll normally find in the ‘zabbix_server.conf’ configuration file, can also be set with this role.

Lets give an example:

When we need to set the StartPollers to value 10, we can update the MySQL playbook to look like this:

---
- hosts: localhost
  roles:
    - role: geerlingguy.mysql
    - role: ansible-zabbix-server
      zabbix_url: zabbix.example.com
      zabbix_version: 2.4
      database_type: mysql
      database_type_long: mysql
      server_dbuser: zabbix-server
      server_dbpassword: zabbix-server
      server_startpollers: 10

When the role is executed on the ‘zabbix-server’, we see the following in the configuration file:

### option: startpollers
#	number of pre-forked instances of pollers.
#
StartPollers=10

Keep in mind to lower the property setting and prefix it with ‘server_’ and you’ll have the property for this Ansible role.

As this Ansible role isn’t perfect, please let me know if you encounter any issues by creating an issue. Pull Request for bugs or new features are always welcome!

wdijkerman-zabbix version 1.7.0 puppet module released

Puppet LogoZabbix Logo

I just released an new version of the wdijkerman-zabbix puppet module: 1.7.0.

This is an “Pull requests” release, as this release only contains pull requests created by users of this module. 🙂

The change log for this release:

  • misspelled parameter path #116 (By pull request: karolisc (Thanks!))
  • Update template.pp #121 (By pull request: claflico (Thanks!))
  • add support for CloudLinux #122 (By pull request: bastelfreak (Thanks!))
  • Fping wrong path in debian #124 (By pull request: Oyabi (Thanks!))
  • refactoring of repo.pp #126 (By pull request: bastelfreak (Thanks!))
  • Added supporting new Zabbix params #128 (By pull request: akostetskiy (Thanks!))
  • Generalise the zabbix_url #129 (By pull request: DjxDeaf (Thanks!))

The “#<NUM>” is a reference to an Github issue. The release can now also be found on and downloaded from the forge.

If you find an bug or have an improvement for this Zabbix puppet module, please create pull requests!

wdijkerman-zabbix version 1.6.0 puppet module released

Puppet LogoZabbix Logo

I just released an new version of the wdijkerman-zabbix puppet module: 1.6.0.

Not yet puppet 4 compliant. I have some local issues with my puppet environment, but I hadn’t released in a while and there where some pull requests which I accepted a while back. So this release is mostly pull requests and support for Debian 8 to!

The change log for this release:

  • Pass manage_repo and zabbix_repo to repo.pp and prevent double include #110 (By pull request: mmerfort (Thanks!))
  • Add “eno” to interface name matching #104 (By pull request: sgnl05 (Thanks!))
  • use the new puppetlabs-apt version 2.x module #103 (By pull request: hmn (Thanks!))
  • Fix name startvmwarecollector -> startvmwarecollectors #102 (By pull request: BcTpe4HbIu (Thanks!))
  • Custom apache IP and port #99 (By pull request: mschuett (Thanks!))
  • Feature Request: add charset/collate option during a mysql db resource creation #107
  • Added support Debian 8
  • Fixed some rpsec tests
  • Fixed some puppet-lint identation warnings
  • Updated the zabbixapi gem install with recent versions

The “#<NUM>” is a reference to an Github issue. The release can now also be found on and downloaded from the forge.

If you find an bug or have an improvement for this Zabbix puppet module, please create pull requests!