<?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/"
	>

<channel>
	<title>Opsview Labs &#187; CGI</title>
	<atom:link href="http://labs.opsview.com/tag/cgi/feed/" rel="self" type="application/rss+xml" />
	<link>http://labs.opsview.com</link>
	<description>Opsview&#039;s Engineering Blog</description>
	<lastBuildDate>Fri, 20 Jan 2012 09:32:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Lessons in &#8230; RSS</title>
		<link>http://labs.opsview.com/2006/07/lessons-in-rss/</link>
		<comments>http://labs.opsview.com/2006/07/lessons-in-rss/#comments</comments>
		<pubDate>Fri, 07 Jul 2006 13:34:33 +0000</pubDate>
		<dc:creator>tonvoon</dc:creator>
				<category><![CDATA[Opsview]]></category>
		<category><![CDATA[CGI]]></category>
		<category><![CDATA[RSS]]></category>

		<guid isPermaLink="false">http://labs.opsview.com/2006/07/lessons-in-rss.html</guid>
		<description><![CDATA[How to integrated RSS alerts into Opsview.

Update: RSS4NAGIOS updated to 1.1 to support host notifications.
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Flabs.opsview.com%2F2006%2F07%2Flessons-in-rss%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Flabs.opsview.com%2F2006%2F07%2Flessons-in-rss%2F&amp;style=normal&amp;b=2" height="61" width="50" />
			</a>
		</div><p>We had a request to integrate RSS feeds into Opsview. People were getting fed up with their amount of emails! Fair enough (I get hundreds of emails a day), but the idea was also that you could use a mobile phone to see the trail of alerts too.</p>
<p>We looked at the current offerings for RSS at <a href="http://nagiosexchange.org">Nagios Exchange</a>, but weren&#8217;t too keen on them. Ssugar&#8217;s <a href="http://www.nagiosexchange.org/Notifications.35.0.html?&#038;tx_netnagext_pi1[p_view]=314">RSS notifications</a> works by using a notification script for a single admin user. This writes a single RSS feed which then people can subscribe to. The main problem with this is that the feed is not personalised &#8211; if I was in the networking team, I don&#8217;t want to know about the Oracle alerts.</p>
<p>Steve Shipway correctly <a href="http://www.nagiosexchange.org/Notifications.35.0.html?&#038;tx_netnagext_pi1[forum]=1&#038;tx_netnagext_pi1[view]=1&#038;tx_netnagext_pi1[project]=314&#038;tx_netnagext_pi1[sub]=0&#038;tx_netnagext_pi1[comment]=372&#038;tx_netnagext_pi1[back]=YToxOntzOjY6InBfdmlldyI7czozOiIzMTQiO30%3D">identified</a> this problem. His software, <a href="http://www.nagiosexchange.org/Frontends.37.0.html?&#038;tx_netnagext_pi1[p_view]=564">Nagios RSS</a>, uses a slimmed down version of the Nagios status CGIs. Again, we weren&#8217;t keen on this &#8211; it only works with Nagios 1.x, the CGIs are going to disappear by 3.x and there&#8217;s a continuous poll on the Nagios server.</p>
<p>So we had to design our own. Our main requirement was to get personalised, authenticated feeds. As little performance overhead would be nice too!</p>
<p>We originally though about some central store of alerts and then a CGI to extract just the alerts required, based on the authenticated user. But it would have been a nightmare to work out what each contact was allowed to see. The key was that Nagios already knows this information, so just let Nagios do it!</p>
<p>Turns out, the trick is to use notifications <i>per contact</i> &#8211; each contact that wants RSS feeds has to specify it. This then becomes a direct replacement for email! Superb!</p>
<pre style="overflow: auto">
define contact {
contact_name	admin
...
service_notification_commands	service-notify-by-email,service-notify-by-rss
}
</pre>
<p>Even better &#8211; because this hooks into Nagios&#8217; <a href="http://opsview.hub.altinity/nagios/docs/notifications.html">notifications</a>, re-notifications will work, as will acknowledgements and <a href="http://opsview.hub.altinity/nagios/docs/escalations.html">escalations</a>.</p>
<p>One possible problem is that notifications only happen with HARD state changes, so you may not see a problem as quickly as you would from a web browser. However, you wouldn&#8217;t get your email either.</p>
<p>We store each contact&#8217;s RSS feeds in a separate file, just like their mail server. When a user comes in to read their feed, they only get their data. Perfect!</p>
<p>But, how do we get a user&#8217;s authentication? Originally, we were thinking that a user goes to <em>http://nagios.server.com/feeds/username</em> to get their feed, but that wouldn&#8217;t provide the security. As CGIs already have security, why not have a single point, but then read their RSS feed independently?</p>
<p>So now the URL is fixed for everyone: <em>http://nagios.server.com/cgi-bin/rss.cgi</em>. When authenticated, the cgi will read that contact&#8217;s feed and return that information. There is a CGI invocation overhead, but I think it is necessary one. The CGI only reads a single file, and not try to work out status of all services.</p>
<p>Because it is a single feed, we can use nice things like have the web browser show RSS icons. We amend our HTML headers to be:</p>
<pre style="overflow: auto">
&lt;link title="Opsview feed" type="application/rss+xml" rel="alternate" href="/nagios/cgi-bin/rss.cgi" /&gt;
</pre>
<p>On Safari, this displays an RSS box which you can click.</p>
<p><img src="http://altinity.blogs.com/dotorg//safari bar.png" border="0" height="38" width="487" alt="safari bar.png" align="" /></p>
<p>Job done!</p>
<p>We call this software RSS4NAGIOS and you can get it <a href="http://altinity.blogs.com/dotorg/rss4nagios-1.0.tar.gz">here</a>.</p>
<p>We&#8217;ve tested on <a href="http://www.mozilla.com/firefox/">Firefox</a> 1.5+, but we recommend using <a href="http://ranchero.com/netnewswire">NetNewsWire</a> for MacOSX.</p>
<p>By the way, we wanted to use <a href="http://www.intertwingly.net/wiki/pie/Rss20AndAtom10Compared">Atom</a> instead of RSS2, but we just couldn&#8217;t get the <a href="http://search.cpan.org/dist/XML-Atom-Syndication/">XML::Atom::Syndication</a> perl module to work nicely. This would be a good enhancement in future (we were thinking things like if a recovery happens, then the earlier failure should be marked as read &#8211; this would be impossible in email).</p>
<p>Let us know what you think!</p>
<p>[Update: RSS4NAGIOS 1.1 <a href="http://altinity.blogs.com/dotorg//rss4nagios-1.1.tar.gz">released</a> to support host notifications]</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.opsview.com/2006/07/lessons-in-rss/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Passive checks going stale immediately on program startup</title>
		<link>http://labs.opsview.com/2006/03/passive-checks-going-stale-immediately-on-program-startup/</link>
		<comments>http://labs.opsview.com/2006/03/passive-checks-going-stale-immediately-on-program-startup/#comments</comments>
		<pubDate>Fri, 17 Mar 2006 09:38:47 +0000</pubDate>
		<dc:creator>tonvoon</dc:creator>
				<category><![CDATA[Nagios]]></category>
		<category><![CDATA[CGI]]></category>
		<category><![CDATA[passive check]]></category>
		<category><![CDATA[pending]]></category>

		<guid isPermaLink="false">http://labs.opsview.com/2006/03/passive-checks-going-stale-immediately-on-program-startup.html</guid>
		<description><![CDATA[
			
				
			
		There&#8217;s a small bug in Nagios 2.0 where passive checks are marked as stale as soon as Nagios starts up. This will change it so that passive checks will be marked as stale when it exceeds the freshness_threshold after startup.
We&#8217;ve already sent this to the nagios-devel mailing list and Ethan has applied this to the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Flabs.opsview.com%2F2006%2F03%2Fpassive-checks-going-stale-immediately-on-program-startup%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Flabs.opsview.com%2F2006%2F03%2Fpassive-checks-going-stale-immediately-on-program-startup%2F&amp;style=normal&amp;b=2" height="61" width="50" />
			</a>
		</div><p>There&#8217;s a small bug in Nagios 2.0 where passive checks are marked as stale as soon as Nagios starts up. This will change it so that passive checks will be marked as stale when it exceeds the freshness_threshold after startup.</p>
<p>We&#8217;ve already sent this to the nagios-devel mailing list and Ethan has applied this to the Nagios 2.x branch in CVS, but we thought we&#8217;d add this here for completeness.</p>
<p>You can get the patch <a href="http://altinity.blogs.com/dotorg/patches/freshness_for_slaves.c.patch">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.opsview.com/2006/03/passive-checks-going-stale-immediately-on-program-startup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passive checks initially displayed in CGIs as OK</title>
		<link>http://labs.opsview.com/2006/03/passive-checks-initially-displayed-in-cgis-as-ok/</link>
		<comments>http://labs.opsview.com/2006/03/passive-checks-initially-displayed-in-cgis-as-ok/#comments</comments>
		<pubDate>Mon, 13 Mar 2006 15:45:22 +0000</pubDate>
		<dc:creator>tonvoon</dc:creator>
				<category><![CDATA[Nagios]]></category>
		<category><![CDATA[CGI]]></category>
		<category><![CDATA[Opsview]]></category>
		<category><![CDATA[peding]]></category>
		<category><![CDATA[SNMP traps]]></category>

		<guid isPermaLink="false">http://labs.opsview.com/2006/03/passive-checks-initially-displayed-in-cgis-as-ok.html</guid>
		<description><![CDATA[
			
				
			
		This is a potentially controversial patch, so may not get into the Nagios core code.
We&#8217;re working on integrating SNMPtraps into Opsview which are passive checks by nature. However, when a service is initially added into Nagios, the CGIs show them in a PENDING state, which looks like an error. We prefer to have a sea [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Flabs.opsview.com%2F2006%2F03%2Fpassive-checks-initially-displayed-in-cgis-as-ok%2F">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Flabs.opsview.com%2F2006%2F03%2Fpassive-checks-initially-displayed-in-cgis-as-ok%2F&amp;style=normal&amp;b=2" height="61" width="50" />
			</a>
		</div><p>This is a potentially controversial patch, so may not get into the Nagios core code.</p>
<p>We&#8217;re working on integrating SNMPtraps into Opsview which are passive checks by nature. However, when a service is initially added into Nagios, the CGIs show them in a PENDING state, which looks like an error. We prefer to have a sea of green when things are OK.</p>
<p>A PENDING state is fine for a distributed monitoring setup, because the active check on the slaves will get through to the master soon, but not with other &#8220;irregular&#8221; passive checks. I couldn&#8217;t find a way to distinguish between a passive, &#8220;going to get a result from a distributed slave soon&#8221;, and a passive, &#8220;don&#8217;t know when the next result is going to be&#8221;.</p>
<p>So this <a href="http://altinity.blogs.com/dotorg/patches/nagios_initial_passive_ok_1.patch">patch</a> will amend the CGIs so that passive checks (or more precisely, checks that are not scheduled to run) are displayed as OK, rather than PENDING.</p>
]]></content:encoded>
			<wfw:commentRss>http://labs.opsview.com/2006/03/passive-checks-initially-displayed-in-cgis-as-ok/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

