Nagios and Icinga have a lot of notification opportunities, receive status via Mail, SMS, Twitter or maybe XMPP? Sometimes is it not easy to decide what you really need and what is better for your quick reaction.
If you have more than one monitor it is easy to overlook an important mail, or your mobile phone is in silent mode and you don’t know that you get a critical notification.
If you are a webmaster and you are working a lot with your browser – there is a solution for Mozilla Firefox with terrible wake up sounds – called Nagios Checker for Mozilla Firefox:
But what is if you are a little bit geeky? You need a geeky solution!
Before I go on, I have to thank the Axxeo GmbH team, which has brought this crazy idea to life, support in the development and financing.
This traffic-light could be your problem prevention system, you will be the first who see and fix it.
Components you need to build it:
– You will need something what looks like a traffic light; I found a old signal tower (siemens/werma) in ebay with some broken leds, no problem new resistors and leds and looks like new:)
– Now you need a controller to switch the lights ; The first and easiest solution that I found was a 8-channel relay card with RS232 and USB ports.
– To run the relay card I used a 12V DC adapter
– To bring the relays to switch you need a piece of software – I used a simply C written program written by Thomas Dohl (If you buy a relay card you will get a CD with source code and some examples)
– To connect the signal tower with relay card I used my old PS2 mice cable
The hard part was to get the newest events from the monitoring system, I started with a cron-job which parsed the output from nagios3stats command, but I stuck with it. There was no useful information about the acknowledged services.
My first code worked without the ack. functions, and it was slow.
Code: This code was written by Enrico Righes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #!/bin/bash NAG=10.1.100.60 NAGIOSFILE="/var/lib/nagios3/retention.dat" STATEFILE="/tmp/nagios.state" OK=0 WARN=1 CRIT=2 UNKNOWN=3 CODES=(00000100 00000010 00000001 00000110) check_state() { egrep "current_state=.|acknowledged=." $NAGIOSFILE | \ ( final=$OK IFS='=' while read key state && read key acked; do [ $acked = 1 ] && continue [[ $final = $OK || $state = $CRIT || ($final = $UNKNOWN && $state = $WARN) ]] && final=$state [ $final = $CRIT ] && break done if [ $(<$STATEFILE) != $final ]; then echo $final >$STATEFILE ssh $NAG "/usr/sbin/relaycontrol -d /dev/ttyS0 -r 1 -s ${CODES[$final]}; beep" >/dev/null fi ) } check_state exit 0 |
By the way some beep signals make the thing much funnier;)
Conclusion:
– It will really help you, be concentrated on your work and don’t miss the important events
– Nice eye catcher
Ideas for you!
– If you have a arduino board, it is the perfect solution for that
– If you want to buy a relay card, try to find a 230V one, you could switch a real traffic-light from the street.
– You can play the sounds from the Simpsons Homer: d’oh and Burns: excellent
And of course some pictures: – Click to resize!
Also you can download all photos in original size (~13.3 MB)
zeldor says
Thank you Thijmen! All these components costs about 45€. The universal relay card controller was very expensive, but it has enough free slots for another funky ideas;)
Thijmen Stavenuiter says
How much did it cost overall? :) Looks awesom!
kimsanov says
That is really cool!