Puppet Tips&Tricks: Converting booleans to numbers
This post is a part of my series about tips and tricks for puppet, the configuration management tool we prefer to use here at Kumina.
Puppet has nice support for Nagios via its Nagios-specific resources. However, this requires you to use “0″ and “1″ instead of “true” and “false” for booleans in Nagios. Because we like uniformity, I’ve created a little function that simply converts a named boolean to a numerical. Check it out:
module Puppet::Parser::Functions
newfunction(:bool2num, :type => :rvalue) do |args|
case args[0]
when "true" then "1"
when "false" then "0"
when "1" then "1"
when "0" then "0"
when true then "1"
when false then "0"
else raise Puppet::ParseError, "Either specify true, false, 1 or 0."
end
end
end
Hope this helps someone!
Tags: application, calendar, google calender, helpdesk, ical, nagios, python, shifts
Comments Off
Kumishifts: The Release
[Repost from Kumiblog]
One of my personal missions within Kumina is to decrease the amount of noise. We work fairly event-driven, responding to everything that gets reported. Although I believe our customers like this very much, it can be a bit of a bother in the case where someone is not on helpdesk duty. One of my pet peeves was the fact that Nagios sent SMS alerts to everyone, instead of the person who was on duty at the time.
Since we have multiple Nagios instances, it would be a bit of a hassle to change the config everywhere all the time, so we stuck with the current way. At least you can be sure that someone received the message. But since we get some false positives too, at time, it does add to the bill.
So I decided to create Kumishifts. This little Python script takes a Google Calendar (or any ical you point it at) and distills who’s on duty. It generated a Nagios contacts file based on that information (and then some). We can now actually work with escalations to make sure that if the first person responsible doesn’t respond fast enough (bad person!), a second one will get the message after a little while, too.
We’re not yet deploying the script everywhere, but will soon, after it’s properly tested. I’d appreciated any feedback on the app!
check_ldap with starttls for Nagios
Since we use Nagios to monitor services and hosts with customers and OpenLDAP for accounts, we’d like to check if LDAP is still active and working. But we had a problem here, because the check_ldap plugin that’s distributed in Debian‘s nagios-plugins package doesn’t speak STARTTLS. So I modified the source-code of check_ldap and created check_ldap_starttls. Some might (and have) argue that using ldaps:// would be easier to implement, but that’s a non-argument, for as far as we’re concerned, since ldaps:// is deprecated.
As usual, you can find my files right here. I claim no copyright to the code whatsoever, since I only added about 8 lines and most of those were copied from some other programme. Use as you see fit.
- check_ldap_starttls (the programme)
- check_ldap_starttls.c (the code)
Enjoy!
Update Been fixed in the latest packages, I believe. Removed the links here.






