Puppet module to manage SmokePing

Managing SmokePing with Puppet is now easy, thanks to my new Puppet module, published on Puppet Forge and Github. It can be installed using puppet module install tobru/smokeping

With this module its possible to completely manage SmokePing, including Master/Slave configuration and the menu hierarchy. It uses exported resources to collect the slave definitions on the master. Because SmokePing does not support configuration directories (f.e. include /etc/smokeping/conf.d) we need to include every single file with @include. To achieve that I make use of the Concat module, written by R.I.Pienaar

Examples on how to use this module can be found on Github in the Readme file.

How it works

It's basically a simple module, installing a package, a service definition and some configuration files, defined with templates. The tricky parts are the slave and target definitions:

Slaves are SmokePing instances without any local files or configuration, they get their configuration from the master, connecting via HTTP to the CGI, and reporting back the probe results. They authenticate themself with a shared secret. Using the class smokeping, with the mode set to slave, configures SmokePing to connect to master_url, generates a shared secret and exports its configuration with exported resources. They are then collected by the instance which mode is set to master.

To implement the target definitions with hierarchies I use concat to tie the configuration files together. Using the hierarchy_level parameter it's possible to build a menu hierarchy. Levels higher than 1 need also the parameter hierarchy_parent to specify it's parent. The level is used as prefix for the file name (f.e. 1-World, 2-Google) and it includes to lower level files using @include.

Example:

# Top Level
smokeping::target { 'World':
    menu      => 'World',
    pagetitle => 'Connection to the World',
    alerts    => [ 'bigloss', 'noloss' ]
}
 
smokeping::target { 'GoogleCH':
    hierarchy_parent => 'World',
    hierarchy_level  => 2,
    menu             => 'google.ch',
    pagetitle        => 'Google',
}
smokeping::target { 'GoogleCHIPv4':
    hierarchy_parent => 'GoogleCH',
    hierarchy_level  => 3,
    menu             => 'google.ch IPv4',
    host             => 'google.ch',
    slaves           => ['slave1'],
}
smokeping::target { 'GoogleCHIPv6':
    hierarchy_parent => 'GoogleCH',
    hierarchy_level  => 3,
    menu             => 'google.ch IPv6',
    host             => 'google.ch',
    probe            => 'FPing6'
    slaves           => ['slave1'],
}

This creates the following content in /etc/smokeping/config.d/targets.d/1-World (which is included in /etc/smokeping/config.d/Targets:

+ World

menu = World
title = Connection to the World
alerts = bigloss,noloss

@include /etc/smokeping/config.d/targets.d/2-GoogleCH

And in /etc/smokeping/config.d/targets.d/2-GoogleCH

++ GoogleCH

menu = google.ch
title = Google

@include /etc/smokeping/config.d/targets.d/3-GoogleCHIPv4
@include /etc/smokeping/config.d/targets.d/3-GoogleCHIPv6

The files starting with 3- include the final target host definition:

+++ GoogleCHIPv4

menu = google.ch IPv4
title = google.ch IPv4
host = google.ch
slaves = slave1
+++ GoogleCHIPv6
probe = FPing6

menu = google.ch IPv6
title = google.ch IPv6
host = google.ch
slaves = slave1
You've successfully subscribed to Tobias Brunner aka tobru
Great! Next, complete checkout to get full access to all premium content.
Error! Could not sign up. invalid link.
Welcome back! You've successfully signed in.
Error! Could not sign in. Please try again.
Success! Your account is fully activated, you now have access to all content.
Error! Stripe checkout failed.
Success! Your billing info is updated.
Error! Billing info update failed.