Using the PROWL push service for your nagios notifications on your IPhone

Prowl is a Growl client for Apples IPhone OS. Notification can be send from your MAC, Windows computer or via API Call directly by the Prowl service gateway. Notifications are directly send to your IPhone or IPod touch using push technology. To receive push notifications it’s NOT necessary to run the application on your device as background process. It’s a nice alternative to SMS.

Today I spent some time to setup our nagios monitoring service with Prowl API calls. Here you can find a littlw How-To for your setup:

1. Download the Prowl Perl Script directly on your nagios server:


wget http://prowl.weks.net/static/prowl.pl

Now, try it out to be sure the perl script works:

/usr/local/bin/prowl.pl -apikey='yourAPIkeyHere' -application='prowl.pl' -event='Testnotification' -notification='Text part of the notification'

You should get a ‘Notification successfully posted.’ message. It should popup directly on your Iphone after one second!

2. Now we come the nagios part:
First, you need to set up your contact information. Edit whichever file you keep your contacts in, and modify an existing record, or add a new one, similar to this:


define contact{
contact_name robert_pager
alias Robert Erlinger
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-prowl
host_notification_commands notify-host-by-prowl
_prowl_apikey yourAPIkeyGoesHere
}

It is very important that you leave the underscore in front of the _prowl_apikey variable, as Nagios’ custom variables depend on it. Next, you’ll need to add the custom prowl notification commands. Edit the appropriate file, and add these commands:


define command{
command_name notify-host-by-prowl
command_line /usr/bin/perl -w /usr/local/nagios3/libexec/prowl.pl -apikey="$_CONTACTPROWL_APIKEY$" -priority=1 -application="Nagios" -event="Host" -notification="$HOSTNAME$ $SERVICEDESC$ '$SERVICEOUTPUT$'"
}
define command{
command_name notify-service-by-prowl
command_line /usr/bin/perl -w /usr/local/nagios3/libexec/prowl.pl -apikey="$_CONTACTPROWL_APIKEY$" -priority=1 -application="Nagios" -event="Service" -notification="$HOSTNAME$ $SERVICEDESC$ '$SERVICEOUTPUT$'"
}

If you have any trouble, check the nagios debug logs, (you may need to turn up the nagios debug level) and try to run the command it’s producing as the nagios user.


Subscribe to comments Comment | Trackback |
Post Tags: , , , ,

Browse Timeline


Comments ( 1 Comment )

Thanks for this post, I was looking for information like this.

Serge added these pithy words on Mar 18 10 at 6:14 pm

Add a Comment


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>