Skip to content

Puppet versioncmp mnemonic

With the release of the Future Parser in Puppet 4 the type system got a complete overhaul. Comparing a string to an integer is no longer an accepted language contruct. This is a good thing because it prevents unforeseen errors. But your legacy code may contain comparisons between facts facts like $operatingsystemmajrelease and (numeric) version numbers. For Puppet 4 this code should use the versioncmp function instead.

Continue reading "Puppet versioncmp mnemonic"

Enter Puppet top scope symbols with Emacs Abbrev mode

Puppet manages variables in different scopes. Global variables and all facts are defined in top scope. To make this explicit, these variables and facts should be accessed using the top scope notation. So in a Puppet manifest the hostname fact should for example be written as $::hostname. Here is a piece of Emacs code that automatically adds the double-colon namespace separator to variable and fact names.

Continue reading "Enter Puppet top scope symbols with Emacs Abbrev mode"

Zabbix low-level discovery using Puppet

Zabbix low-level discovery automatically detects host entities to monitor and creates the associated Zabbix items, triggers and graphs. Mounted file systems and network interfaces are two popular types of items that are supported by a vanilla installation of Zabbix on a Linux host. Zabbix can be extended to discover other things by adding so-called user parameters to the agent configuration. Normally these are scripts that output a JSON formatted data structure describing the discovered entities. In this article I present a different solution to create the relevant data by using Puppet.

Continue reading "Zabbix low-level discovery using Puppet"