Nagios/Icinga meets Nabaztag

Posted on Monday, February 15th, 2010 at 1:25 am in

Since i have my Nabaztag-Bunny i ever wanted to use it for my Icinga notifications. I’ve found a perl script on the internet. But that one just sent out a message and not used LED flashing or ear movements also provided by the Nabaztag-API.

So I’ve wrote my own notification script in PHP. You can download it here: notify-by-nabaztag.php

You can watch a video demonstrating it in action here in the following embedded Windows Media Player or at YouTube

The script is quite simple. It’s need two arguments. The first one is the message for the TTL (text-to-speech) and the second one is the “notification type”. The notification type is either the service or host state (OK, WARNING, CRITICAL, UNKNOWN, UP, DOWN, UNREACHABLE).

Depending on the notification type the bunny is flashing in a different color and moves it’s ears to another position:

OK/UP: flashing green, ears going up
WARNING: flashing yellow, both ears are moved to the front with an angle of 45┬░
CRITICAL/DOWN: flashing red, ears going down
UNKNOWN/UNREACHABLE: flashing blue, one ear to the front, one to the back, each with an angle of 45┬░

You can configure the voice which should be used inside the script. I propose to use a US/UK one because the states are in English too. I think the script should be self-explaining. If not, just leave an comment.

When you already have Nagios/Icinga up and running you should also know how to add an new notification command. Otherwise here are the basic steps (assuming you are running Icinga within /usr/local/icinga):

1. We need php-cli installed so we can run the script on the CLI. Depending on your distro run on of the following commands

aptitude install php-cli
yum install php-cli

2. Download the script to your libexec-Directory:

wget -O /usr/local/icinga/libexec/notify-by-nabaztag.php

3. Add a host and service notification command. If you want a more detailed output just add it to the right position. You’ll find all available Macros at

vim /usr/local/icinga/etc/objects/commands.cfg

# ‘notify-service-by-nabaztag’ command
define command{
command_name notify-service-by-nabaztag
command_line /usr/bin/php $USER1$/notify-by-nabaztag.php “Monitoring Notification: $NOTIFICATIONTYPE$ on $HOSTNAME$ (Hostalias is $HOSTALIAS$) with Service: $SERVICEDESC$. Current servicestate is $SERVICESTATE$” $SERVICESTATE$

# ‘notify-host-by-nabaztag’ command
define command{
command_name notify-host-by-nabaztag
command_line /usr/bin/php $USER1$/notify-by-nabaztag.php “Monitoring Notification: $NOTIFICATIONTYPE$ on $HOSTNAME$ (Hostalias is $HOSTALIAS$). Hoststate is $HOSTSTATE$” $HOSTSTATE$

4. I’ve created a new time period, because I don’t want that my bunny is talking to me during the night 😉

vim /usr/local/icinga/etc/objects/timeperiods.cfg

# ‘nabazhours’

define timeperiod{
timeperiod_name nabazhours
alias Where my nabaztag is active
monday 06:00-23:00
tuesday 06:00-23:00
wednesday 06:00-23:00
thursday 06:00-23:00
friday 06:00-23:00
saturday 08:00-23:00
sunday 08:00-23:00

5. After that a new contact is created which use the above added notification commands and the right time period

vim /usr/local/icinga/etc/objects/contacts.cfg

define contact{
contact_name nabaztag
use generic-contact
alias My Bunny
service_notification_commands notify-service-by-nabaztag
host_notification_commands notify-host-by-nabaztag
service_notification_period nabazhours
host_notification_period nabazhours

6. We should have enough time to run a config-check 😉

/usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg

7. When no errors or warnings appear reload Nagios/Icinga and wait till problem occur 😉

/etc/init.d/icinga reload

Hope everything works as expected and you’ll find this script useful. Have fun with Nagios/Icinga and your Bunny. J

You might also be interested in


Add your comment

  1. Karo - February 24, 2010 at 10:19 pm

    Hans, that is very very cute and I had to tweet this! Now I just have to convince my colleague to want one too:-) Take care! Karo

  2. Scott Evans - February 25, 2010 at 11:50 am

    Such a great use of this product! Oh and using Icinga make you super cool !!!

  3. hans - March 2, 2010 at 1:31 am

    Thanks folks 🙂

    I’ve created another video which shows Nabaztag in a “real life szenario”. On recovery and a critical state with the notify-script. And the status-script is executed in the middle of the video. See

  4. Network Monitoring Software - March 22, 2010 at 2:14 pm

    […] sperrgebiet's world: Nagios/Icinga meets Nabaztag […]

Leave a Reply

Leave A Comment