<?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>redstack &#187; Hacks</title>
	<atom:link href="http://redstack.net/blog/category/hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://redstack.net/blog</link>
	<description>Pirates are way cooler than Ninjas, but not as much as Samuraïs</description>
	<lastBuildDate>Sun, 11 Apr 2010 14:49:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Ssdeep Ruby Bindings</title>
		<link>http://redstack.net/blog/2010/04/10/ssdeep-ruby-bindings/</link>
		<comments>http://redstack.net/blog/2010/04/10/ssdeep-ruby-bindings/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 18:24:18 +0000</pubDate>
		<dc:creator>xipe</dc:creator>
				<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://redstack.net/blog/?p=195</guid>
		<description><![CDATA[As I couldn&#8217;t find any ruby bindings for ssdeep, I decided to write it as my first ruby extension today &#8230; Installation (prerequisites) You first need to compile/install the ssdeep library. On debian testing: 1 $ apt-get install ssdeep On other Linuxes/Unixes: 1 2 3 4 5 6 $ wget http://sourceforge.net/projects/ssdeep/files/ssdeep-2.4/ssdeep-2.4.tar.gz/download $ tar zxvf ssdeep-2.4.tar.gz [...]]]></description>
			<content:encoded><![CDATA[<p>As I couldn&#8217;t find any ruby bindings for <a href="http://ssdeep.sourceforge.net">ssdeep</a>, I decided to write it as my first ruby extension today &#8230; <img src='http://redstack.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Installation (prerequisites)</strong><br />
You first need to compile/install the ssdeep library.<br />
On debian testing:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="sh" style="font-family:monospace;">$ apt-get install ssdeep</pre></td></tr></table></div>

<p>On other Linuxes/Unixes:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="sh" style="font-family:monospace;">$ wget http://sourceforge.net/projects/ssdeep/files/ssdeep-2.4/ssdeep-2.4.tar.gz/download
$ tar zxvf ssdeep-2.4.tar.gz
$ cd ssdeep-2.4/
$ ./configure --prefix=/opt
$ make
$ sudo make install</pre></td></tr></table></div>

<p>On windows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="sh" style="font-family:monospace;">$ There is no real shell, and I will not make screen-shots... ;)</pre></td></tr></table></div>

<p><strong>Installation (the real one)</strong><br />
To install it using rubygems:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="sh" style="font-family:monospace;">$ gem install ssdeep</pre></td></tr></table></div>

<p>To install it using rubygems with a non standard ssdeep installatoin path:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="sh" style="font-family:monospace;">$ gem install ssdeep -- --with-ssdeep-dir=/path/to/ssdeep</pre></td></tr></table></div>

<p><strong>Usage</strong><br />
The bindings follow the ssdeep APIs: (for extended information on this functions, check the <a target="_blank" href="http://ssdeep.sourceforge.net/api/html/fuzzy_8h.html">ssdeep API doc.</a>)<br />
<span id="more-195"></span></p>
<ul>
<li>fuzzy_compare(&#8220;3:qGOvn:qRn&#8221;, &#8220;3:Wv:Wv&#8221;): Compare two fuzzy hashes.</li>
<li>fuzzy_hash_buf(&#8220;data&#8221;): return the fuzzy hash of the data buffer.</li>
<li>fuzzy_hash_filename(&#8220;/path/to/file&#8221;): return the fuzzy hash of the file</li>
</ul>
<p><em>fuzzy_hash_file isn&#8217;t implemented.</em></p>
<p>Here is a little usage example :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'ssdeep'</span>
  <span style="color:#008000; font-style:italic;"># Fuzzy hash a buffer's content</span>
  hash1 = Ssdeep.<span style="color:#9900CC;">fuzzy_hash_buf</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;This string contains the data of first file :)&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#008000; font-style:italic;"># Fuzzy hash the content of the file '/path/to/file'</span>
  hash2 = Ssdeep.<span style="color:#9900CC;">fuzzy_hash_filename</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;/path/to/file&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#008000; font-style:italic;"># Compare the 2 hashes, a value between 0 (no match) and 100 (full match) is returned</span>
  Ssdeep.<span style="color:#9900CC;">fuzzy_compare</span><span style="color:#006600; font-weight:bold;">&#40;</span>hash1, hash2<span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

<p>Et voilà <img src='http://redstack.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Links</strong><br />
<a target="_blank" href="http://redstack.net/code/cgi-bin/darcsweb.cgi?r=ruby-ssdeep;a=summary">Ssdeep Ruby bindings source code</a><br />
<a target="_blank" href="http://rubygems.org/gems/ssdeep">RubyGems project page</a><br />
<a target="_blank" href="http://ssdeep.sourceforge.net">Ssdeep project page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://redstack.net/blog/2010/04/10/ssdeep-ruby-bindings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios status report in Ion3 statusbar</title>
		<link>http://redstack.net/blog/2008/05/08/nagios-status-report-in-ion3-statusbar/</link>
		<comments>http://redstack.net/blog/2008/05/08/nagios-status-report-in-ion3-statusbar/#comments</comments>
		<pubDate>Thu, 08 May 2008 20:54:24 +0000</pubDate>
		<dc:creator>xipe</dc:creator>
				<category><![CDATA[Hacks]]></category>

		<guid isPermaLink="false">http://redstack.net/blog/index.php/2008/05/08/nagios-status-report-in-ion3-statusbar.html</guid>
		<description><![CDATA[Here is a little script that permits to report one or more nagios servers status in the ion3 status bar: statusd_nginfo.lua (Download) -- -- statusd_nginfo.lua -- -- Made by Raffaello Pelagalli -- -- Started on Sun Mar 9 00:22:31 2008 Raffaello Pelagalli -- Last update Thu May 8 23:29:32 2008 Raffaello Pelagalli -- -- This [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a little script that permits to report one or more nagios servers status in the ion3 status bar:</p>
<p><strong>statusd_nginfo.lua</strong> (<a href='http://redstack.net/blog/wp-content/uploads/2008/05/statusd_nginfo.lua' title='statusd_nginfo.lua'>Download</a>)<br />
<span id="more-19"></span></p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">--</span>
<span style="color: #808080; font-style: italic;">-- statusd_nginfo.lua</span>
<span style="color: #808080; font-style: italic;">-- </span>
<span style="color: #808080; font-style: italic;">-- Made by Raffaello Pelagalli</span>
<span style="color: #808080; font-style: italic;">-- </span>
<span style="color: #808080; font-style: italic;">-- Started on  Sun Mar  9 00:22:31 2008 Raffaello Pelagalli</span>
<span style="color: #808080; font-style: italic;">-- Last update Thu May  8 23:29:32 2008 Raffaello Pelagalli</span>
<span style="color: #808080; font-style: italic;">-- </span>
<span style="color: #808080; font-style: italic;">-- This library is free software; you can redistribute it and/or</span>
<span style="color: #808080; font-style: italic;">-- modify it under the terms of the GNU Lesser General Public</span>
<span style="color: #808080; font-style: italic;">-- License as published by the Free Software Foundation; either</span>
<span style="color: #808080; font-style: italic;">-- version 2.1 of the License, or (at your option) any later version.</span>
<span style="color: #808080; font-style: italic;">-- </span>
<span style="color: #808080; font-style: italic;">-- This library is distributed in the hope that it will be useful,</span>
<span style="color: #808080; font-style: italic;">-- but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span style="color: #808080; font-style: italic;">-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<span style="color: #808080; font-style: italic;">-- Lesser General Public License for more details.</span>
<span style="color: #808080; font-style: italic;">-- </span>
<span style="color: #808080; font-style: italic;">-- You should have received a copy of the GNU Lesser General Public</span>
<span style="color: #808080; font-style: italic;">-- License along with this library; if not, write to the Free Software</span>
<span style="color: #808080; font-style: italic;">-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA</span>
<span style="color: #808080; font-style: italic;">-- 02111-1307  USA</span>
<span style="color: #808080; font-style: italic;">--</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- Nagios checking script</span>
<span style="color: #808080; font-style: italic;">-- Reports nagios status in ion status bar</span>
<span style="color: #808080; font-style: italic;">-- Sample configuration:</span>
<span style="color: #808080; font-style: italic;">-- mod_statusbar.launch_statusd{</span>
<span style="color: #808080; font-style: italic;">--    ...</span>
<span style="color: #808080; font-style: italic;">--    nginfo = {</span>
<span style="color: #808080; font-style: italic;">--       urls = {</span>
<span style="color: #808080; font-style: italic;">--          &quot;http://user1:password1@server1.domain1.tld/cgi-bin/nagios2/nginfo.pl&quot;,</span>
<span style="color: #808080; font-style: italic;">--          &quot;http://user2:password2@server2.domain2.tld/nagios/cgi-bin/nginfo.pl&quot;,</span>
<span style="color: #808080; font-style: italic;">--       },</span>
<span style="color: #808080; font-style: italic;">--    }</span>
<span style="color: #808080; font-style: italic;">--    ...</span>
<span style="color: #808080; font-style: italic;">-- }</span>
<span style="color: #808080; font-style: italic;">--</span>
<span style="color: #808080; font-style: italic;">-- Need to be used with nginfo.pl script from</span>
<span style="color: #808080; font-style: italic;">-- http://redstack.net/blog/index.php/2008/05/08/nagios-status-report-in-ion3-statusbar.html</span>
&nbsp;
<span style="color: #b1b100;">require</span> <span style="color: #ff0000;">&quot;lxp&quot;</span>
<span style="color: #b1b100;">local</span> ng_timer
<span style="color: #b1b100;">local</span> <span style="color: #b1b100;">error</span> <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">false</span>
&nbsp;
<span style="color: #b1b100;">local</span> status <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">local</span> defaults <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span> 
   update_interval<span style="color: #66cc66;">=</span><span style="color: #cc66cc;">30</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">1000</span>, 
   urls <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">&#125;</span>,
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">local</span> settings <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">table</span>.join<span style="color: #66cc66;">&#40;</span>statusd.get_config<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;nginfo&quot;</span><span style="color: #66cc66;">&#41;</span>, defaults<span style="color: #66cc66;">&#41;</span>
&nbsp;
nginfo_callbacks <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
   StartElement <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">function</span> <span style="color: #66cc66;">&#40;</span>parser, name<span style="color: #66cc66;">&#41;</span>
                     <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>name <span style="color: #66cc66;">==</span> <span style="color: #ff0000;">&quot;current_state&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
                        nginfo_callbacks.CharacterData <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">function</span> <span style="color: #66cc66;">&#40;</span>parser, val<span style="color: #66cc66;">&#41;</span>
                                                            status<span style="color: #66cc66;">&#91;</span><span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>val<span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> 
                                                               status<span style="color: #66cc66;">&#91;</span><span style="color: #b1b100;">tonumber</span><span style="color: #66cc66;">&#40;</span>val<span style="color: #66cc66;">&#41;</span> + <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span> + <span style="color: #cc66cc;">1</span>
                                                         <span style="color: #b1b100;">end</span>
                     <span style="color: #b1b100;">end</span>
                  <span style="color: #b1b100;">end</span>,
   EndElement <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">function</span> <span style="color: #66cc66;">&#40;</span>parser, name<span style="color: #66cc66;">&#41;</span>
                   <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>name <span style="color: #66cc66;">==</span> <span style="color: #ff0000;">&quot;current_state&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
                      nginfo_callbacks.CharacterData <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">false</span>
                   <span style="color: #b1b100;">end</span>
                <span style="color: #b1b100;">end</span>,
   CharacterData <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">false</span>,
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">function</span> parse <span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>
   p <span style="color: #66cc66;">=</span> lxp.new<span style="color: #66cc66;">&#40;</span>nginfo_callbacks<span style="color: #66cc66;">&#41;</span>
   p:parse<span style="color: #66cc66;">&#40;</span>b<span style="color: #66cc66;">&#41;</span>
   p:close<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">end</span>
&nbsp;
<span style="color: #b1b100;">function</span> get_nginfo <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
   status <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#125;</span>
   <span style="color: #b1b100;">error</span> <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">false</span>
   <span style="color: #b1b100;">local</span> http <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">require</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;socket.http&quot;</span><span style="color: #66cc66;">&#41;</span>
   socket.http.TIMEOUT<span style="color: #66cc66;">=</span><span style="color: #cc66cc;">10</span>
   <span style="color: #b1b100;">local</span> errstr <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot; ERROR while reading data&quot;</span>
   <span style="color: #b1b100;">for</span> n, url <span style="color: #b1b100;">in</span> <span style="color: #b1b100;">pairs</span><span style="color: #66cc66;">&#40;</span>settings.urls<span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">do</span>
      b, c, h <span style="color: #66cc66;">=</span> http.request<span style="color: #66cc66;">&#40;</span>url<span style="color: #66cc66;">&#41;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #b1b100;">not</span> <span style="color: #66cc66;">&#40;</span>c <span style="color: #66cc66;">==</span> <span style="color: #cc66cc;">200</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span> 
         <span style="color: #b1b100;">error</span> <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">true</span> 
         errstr <span style="color: #66cc66;">=</span> errstr .. <span style="color: #ff0000;">&quot; (NET &quot;</span> .. <span style="color: #b1b100;">tostring</span><span style="color: #66cc66;">&#40;</span>c<span style="color: #66cc66;">&#41;</span> .. <span style="color: #ff0000;">&quot;)&quot;</span>
      <span style="color: #b1b100;">else</span>
         <span style="color: #b1b100;">local</span> st, err <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">pcall</span><span style="color: #66cc66;">&#40;</span>parse, b<span style="color: #66cc66;">&#41;</span>
         <span style="color: #b1b100;">if</span> <span style="color: #b1b100;">not</span> st <span style="color: #b1b100;">then</span> 
            <span style="color: #b1b100;">error</span> <span style="color: #66cc66;">=</span> <span style="color: #b1b100;">true</span> 
            errstr <span style="color: #66cc66;">=</span> errstr .. <span style="color: #ff0000;">&quot; (XML&quot;</span> .. err .. <span style="color: #ff0000;">&quot;)&quot;</span>
         <span style="color: #b1b100;">end</span>
      <span style="color: #b1b100;">end</span>
   <span style="color: #b1b100;">end</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #b1b100;">not</span> <span style="color: #b1b100;">error</span> <span style="color: #b1b100;">then</span>
      errstr <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;&quot;</span>
   <span style="color: #b1b100;">end</span>
   <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">&quot;OK: &quot;</span> .. <span style="color: #b1b100;">tostring</span><span style="color: #66cc66;">&#40;</span>status<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
      .. <span style="color: #ff0000;">&quot;, WARN: &quot;</span> .. <span style="color: #b1b100;">tostring</span><span style="color: #66cc66;">&#40;</span>status<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
      .. <span style="color: #ff0000;">&quot;, ERROR: &quot;</span> .. <span style="color: #b1b100;">tostring</span><span style="color: #66cc66;">&#40;</span>status<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
      .. <span style="color: #ff0000;">&quot;, UNKN: &quot;</span> .. <span style="color: #b1b100;">tostring</span><span style="color: #66cc66;">&#40;</span>status<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
      .. errstr
<span style="color: #b1b100;">end</span>
&nbsp;
<span style="color: #b1b100;">local</span> <span style="color: #b1b100;">function</span> update_nginfo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
   statusd.inform<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;nginfo&quot;</span>, get_nginfo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>status<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #b1b100;">or</span> status<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
      statusd.inform<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;nginfo_hint&quot;</span>, <span style="color: #ff0000;">&quot;critical&quot;</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #b1b100;">elseif</span> <span style="color: #66cc66;">&#40;</span>status<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">then</span>
      statusd.inform<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;nginfo_hint&quot;</span>, <span style="color: #ff0000;">&quot;important&quot;</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #b1b100;">else</span> 
      statusd.inform<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;nginfo_hint&quot;</span>, <span style="color: #ff0000;">&quot;normal&quot;</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #b1b100;">end</span>
   ng_timer:set<span style="color: #66cc66;">&#40;</span>settings.update_interval, update_nginfo<span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">end</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-- Init</span>
ng_timer<span style="color: #66cc66;">=</span>statusd.create_timer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
update_nginfo<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>This nginfo.pl script needs to be installed on nagios servers :</p>
<p><strong>nginfo.pl</strong>  (<a href='http://redstack.net/blog/wp-content/uploads/2008/05/nginfo.pl' title='nginfo.pl'>Download</a>)</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</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> Nagios<span style="color: #339933;">::</span><span style="color: #006600;">StatusLog</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$log</span> <span style="color: #339933;">=</span> Nagios<span style="color: #339933;">::</span><span style="color: #006600;">StatusLog</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span>
Filename <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">&quot;/var/cache/nagios2/status.dat&quot;</span><span style="color: #339933;">,</span>
Version <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2.0</span> 
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Content-type: text/xml<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&lt;?xml version='1.0'?&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&lt;status&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$host</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$log</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">list_hosts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&lt;host&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;name&gt;$host&lt;/name&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;services&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$serv</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$log</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">list_services_on_host</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$host</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066;">print</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&lt;service&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000066;">print</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">ref</span> <span style="color: #0000ff;">$serv</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$st</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">$log</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">service</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$host</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$serv</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
                <span style="color: #b1b100;">foreach</span> <span style="color: #0000ff;">$tag</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$st</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">list_tags</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000066;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&lt;$tag&gt;$$st{$tag}&lt;/$tag&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000066;">print</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&lt;/service&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&lt;/services&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;/host&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&lt;/status&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Information on installing lua scipts for ion3 can be found <a href="http://modeemi.fi/~tuomov/repos/ion-scripts-3/#using">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://redstack.net/blog/2008/05/08/nagios-status-report-in-ion3-statusbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
