<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:ymaps="http://api.maps.yahoo.com/Maps/V2/AnnotatedMaps.xsd">

<channel>
	<title>Michael`s Blog &#187; prowl</title>
	<atom:link href="http://blog.streb.name/tag/prowl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.streb.name</link>
	<description>OSS/Linux, networking and my private life</description>
	<lastBuildDate>Thu, 27 Jan 2011 12:11:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>OpenNMS Prowl Alerts</title>
		<link>http://blog.streb.name/2009/12/14/opennms-prowl-alerts/</link>
		<comments>http://blog.streb.name/2009/12/14/opennms-prowl-alerts/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 08:02:43 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[it]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[opennms]]></category>
		<category><![CDATA[alerts]]></category>
		<category><![CDATA[prowl]]></category>

		<guid isPermaLink="false">http://blog.streb.name/?p=240</guid>
		<description><![CDATA[Nachdem ich als iPhone Nutzer auch Prowl installiert habe ging es nun darum mein OpenNMS mit Prowl für die Alarmierung zu koppeln.
Da Prowl eine gut beschriebene API bietet und ebenfalls fertige Skripte für diese in verschiedenen Sprachen (Perl,Python,...) zur Verfügung stellt habe ich mich für diese Variante entschieden.
Benutzt habe ich hierfür die Perl Variante, ...]]></description>
			<content:encoded><![CDATA[<p>Nachdem ich als iPhone Nutzer auch <a href="http://prowl.weks.net/">Prowl</a> installiert habe ging es nun darum mein OpenNMS mit Prowl für die Alarmierung zu koppeln.<br />
Da Prowl eine gut beschriebene <a href="http://prowl.weks.net/api.php">API</a> bietet und ebenfalls fertige Skripte für diese in verschiedenen Sprachen (Perl,Python,...) zur Verfügung stellt habe ich mich für diese Variante entschieden.<br />
Benutzt habe ich hierfür die Perl Variante, downloadbar ist prowl.pl <a href="http://prowl.weks.net/static/prowl.pl">hier</a>. </p>
<p>Allerdings gab es bei der Parameterübergabe(API Key, Application, usw.) aus OpenNMS an prowl.pl etwas Schwierigkeiten. Lösung des Problems ist ein kleiner Wrapper der von OpenNMS aufgerufen wird und im Hintergrund entsprechend parametrisiert prowl.pl aufruft.</p>
<p><strong>prowl_wrapper.pl</strong></p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$prowl</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/usr/local/bin/prowl.pl&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$apikey</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$application</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;OpenNMS&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$priority</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$event</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Alert&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$msg</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #000000; font-weight: bold;">ARGV</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #0000ff;">$msg</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">$_</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot; &quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$cmd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$prowl</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot; -apikey &quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$apikey</span><span style="color: #339933;">.</span>
<span style="color: #ff0000;">&quot; -application=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$application</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> -priority=&quot;</span><span style="color: #339933;">.</span>
<span style="color: #0000ff;">$priority</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot; -event=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$event</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> -notification=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$msg</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$return</span> <span style="color: #339933;">=</span> <span style="color: #000066;">qx</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$cmd</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> <span style="color: #0000ff;">$return</span><span style="color: #339933;">;</span></pre></div></div>

<p>Wichtig ist hier die jeweiligen Prowl API-Key für den Wrapper richtig anzupassen, hierfür habe ich die PagerEmail Adresse in OpenNMS verwendet um so für jeden Kontakt eine andere angeben zu können.</p>
<p>Anbei finden sich die notwendigen configs für OpenNMS:</p>
<p><strong>notificationCommands.xml</strong></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;command</span> <span style="color: #000066;">binary</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>notifyProwl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execute<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/usr/local/bin/prowl_wrapper.pl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execute<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>send Prowl notifications<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;argument</span> <span style="color: #000066;">streamed</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;switch<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>-pemail<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/switch<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/argument<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;argument</span> <span style="color: #000066;">streamed</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;switch<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>-subject<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/switch<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/argument<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/command<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://blog.streb.name/2009/12/14/opennms-prowl-alerts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

