Prowl notification
Subscribe

From OpenNMS

Jump to: navigation, search

HOWTO: Notification using Prowl

If you´re a lucky user of an iPhone or an iPod Touch you can configure notifications with Prowl. The result for notification looks like this:

Thank you to Michaels Blog and Alex.

iPod Prowl notification iPod Prowl notification list

To configure this kind of notification the following steps are necessary:

  1. Create Prowl account
  2. Generate API Key
  3. Buy the Prowl App from iTunes AppStore and install it on your iPhone or iPod Touch
  4. Download the Prowl Perlscript and save it in /usr/bin/prowl.pl
  5. Create an OpenNMS wrapper script in /usr/bin/opennms-prowl.pl
  6. You need Perl SSL encryption package to send notifications with HTTPS, on an Ubuntu Box use apt-get install libcrypt-ssleay-perl
  7. Create an OpenNMS Notification Command in $OPENNMS_HOME/etc/notificationCommands.xml
  8. Use the new notification command in your destination path
  9. Add your Prowl mail address in your opennms user field Pager Email

OpenNMS wrapper script

file:/usr/bin/opennms-prowl.pl

#!/usr/bin/perl -w

my $prowl = "/usr/bin/prowl.pl";
my $apikey = "<your-api-key>";
my $application = "OpenNMS";
my $priority = 1;
my $event = "Alert";
my $msg = "";
 
foreach (@ARGV) {
        $msg .= $_." ";
}
 
my $cmd = $prowl." -apikey ".$apikey.
" -application=\"".$application."\" -priority=".
$priority." -event=\"".$event."\" -notification=\"".$msg."\"";
 
my $return = qx( $cmd );
print $return;

Notification command

Add this new notification command in $OPENNMS_HOME/etc/notificationCommands.xml

<command binary="true">
  <name>notifyProwl</name>
  <execute>/usr/bin/opennms-prowl.pl</execute>
  <comment>send Prowl notifications</comment>
  <argument streamed="false">
    <switch>-pemail</switch>
  </argument>
  <argument streamed="false">
    <switch>-subject</switch>
  </argument>
</command>

Restart OpenNMS and have fun with your new notification method.