I thought it’s a good idea to use Nabaztag also for a regular status message about the host and service state.
Based on my other script notify-by-nabaztag.php (see this post) i’ve wrote another little PHP-Script which gets the Nagios/Icinga Status from the nagiostats/icingastats utility and use my notify-by-nabaztag.php to send out a status message. Here it is: status2nabaztag.php
There are just a few steps to get up and running:
1. Grap my notify-by-nabaztag.php and the status2nabaztag.php scripts
wget http://www.sperrgebiet.org/wp-content/uploads/2010/02/notify-by-nabaztag.txt -O /usr/local/icinga/libexec/notify-by-nabaztag.php
wget http://www.sperrgebiet.org/wp-content/uploads/2010/02/status2nabaztag.txt -O /usr/local/icinga/bin/status2nabaztag.php
2. Change, if required, paths to the binaries. Specially $stats & $php
3. Test it 😉
php /usr/local/icinga/bin/status2nabaztag.php
4. Assuming everything worked as expected you can add an entry to your crontab to regulary executes the script. I know, it would be a nicer to use the Nagios/Icinga timeperiod-definitions, but the crontab-entry is easier 😉
vim /etc/crontab
0 6-23 * * * root /usr/bin/php /usr/local/icinga/bin/status2nabaztag.php
This cron entry will executes the script every day between 6am and 11pm.
It’s just a short post, but i think the script should be self explaining too. Furthermore it’s quite late/early, so i’ll try to get some sleep because i have to get up in 3hours 😉
Hope this script is useful too. Please let me know if you have any troubles to get it running.
Leave a Reply