<?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>BarryODonovan.com &#187; Linux</title>
	<atom:link href="http://www.barryodonovan.com/index.php/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.barryodonovan.com</link>
	<description>The thoughts, ramblings and rants of Barry O&#039;Donovan</description>
	<lastBuildDate>Wed, 09 Dec 2009 14:30:55 +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>perl: warning: Falling back to the standard locale (&#8220;C&#8221;)</title>
		<link>http://www.barryodonovan.com/index.php/2009/09/24/perl-locales</link>
		<comments>http://www.barryodonovan.com/index.php/2009/09/24/perl-locales#comments</comments>
		<pubDate>Thu, 24 Sep 2009 10:05:41 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/?p=86</guid>
		<description><![CDATA[Every time I debootstrap a new Debian server for a XenU domain, I get lots of verbose output from Perl scripts: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_IE.UTF-8" are supported and installed on your system. perl: warning: Falling back to [...]]]></description>
			<content:encoded><![CDATA[<p>Every time I <code>debootstrap</code> a new Debian server for a XenU domain, I get lots of verbose output from Perl scripts:</p>
<pre>
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_IE.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
</pre>
<p>The fix is simple:</p>
<pre>
# apt-get install locales
# dpkg-reconfigure locales
</pre>
<p>and select your locales.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2009/09/24/perl-locales/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Kubuntu 8.10 and Mobile Broadband (and KDE 4.1)</title>
		<link>http://www.barryodonovan.com/index.php/2008/10/31/kubuntu-mobile</link>
		<comments>http://www.barryodonovan.com/index.php/2008/10/31/kubuntu-mobile#comments</comments>
		<pubDate>Fri, 31 Oct 2008 11:18:44 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[OSS]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/?p=76</guid>
		<description><![CDATA[Kubuntu 8.10 and mobile broadband - the KNetworkManager has come a long way!]]></description>
			<content:encoded><![CDATA[<p>I updated my laptop from <a href="http://www.kubuntu.com/">Kubuntu 8.04</a> to 8.10 (<a href="http://www.kubuntu.org/news/8.10-release">just released</a>) yesterday. I do 90% of my work on my desktop which needs to <em>just work</em> and, as such, it&#8217;s running Kubuntu 7.10. My laptop, however, I play around with. </p>
<p>Most people&#8217;s first impression of 8.10 will be based on the upgrade process and post install issues. To date, I&#8217;ve always had to fix a lot of problems with the system after an upgrade to make it work. Not this time &#8211; it was absolutely seamless. </p>
<p>I was also apprehensive about KDE 4.1 and, to be honest, I was really worried that in a crunch I&#8217;d have to fall back to Gnome before degrading back to 8.04. I just don&#8217;t have the time these days to follow KDE development as much as I used to and I briefly installed KDE 4 a few months ago and thought it was far from finished. </p>
<p>I&#8217;m delighted to report KDE 4.1 is very slick and very polished. I&#8217;ve only had it for just over 24 but I have no complaints yet.</p>
<p>However, my main motivation for the upgrade was mobile broadband. Like most people, I use my laptop when on the move and my desktop when in the office. My laptop has an Ethernet port and a wi-fi card which both worked great with <a href="http://en.opensuse.org/Projects/KNetworkManager">KNetworkManager</a> but not mobile broadband. I got O2&#8242;s broadband dongle (the small USB stick) about four months ago and rely on it heavily. </p>
<p>I&#8217;ve been using Vodafone&#8217;s Mobile Connect Client to great effect but there were some issues:</p>
<ul>
<li> setting up the connection was a manual process (change X window access control; su to root; export the <code>DISPLAY</code> setting; and start the application); </li>
<li> if I suspended the laptop then I needed to reboot the system to use the dongle again.
</ul>
<p>While both of the above could be solved, it&#8217;s just not plug and play. 8.10 is. With the dongle plugged into the USB port, KNetworkManager discovered the <code>tty</code> port. Configuring it was as easy as right clicking on the KNetworkManager icon and selecting <em>New Connection&#8230;</em> icon for the <code>tty</code> port.</p>
<p>The next step requires knowledge of the O2 / provider settings but this is readily available online. For O2:</p>
<div id="attachment_80" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.barryodonovan.com/wp-content/uploads/2008/11/knetworkmanager-o21.png"><img src="http://www.barryodonovan.com/wp-content/uploads/2008/11/knetworkmanager-o21-300x161.png" alt="KNetworkManager - Settings for O2 Ireland" title="knetworkmanager-o2" width="300" height="161" class="size-medium wp-image-80" /></a><p class="wp-caption-text">KNetworkManager - Settings for O2 Ireland</p></div>
<p>After the above, I just accepted the defaults for the rest of the options. And &#8211; to my delight &#8211; it just worked. And it worked after suspended the laptop. And after popping the USB dongle in and out for the heck of it. By clicking the Auto Connect option as part of the process, it also just works when I pop the dongle in.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2008/10/31/kubuntu-mobile/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>chan_ss7, pcap files and 64bit machines</title>
		<link>http://www.barryodonovan.com/index.php/2008/04/28/chan_ss7-pcap-files-and-64bit-machines</link>
		<comments>http://www.barryodonovan.com/index.php/2008/04/28/chan_ss7-pcap-files-and-64bit-machines#comments</comments>
		<pubDate>Mon, 28 Apr 2008 19:01:32 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[VoIP]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[chan_ss7]]></category>
		<category><![CDATA[ss7]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/?p=75</guid>
		<description><![CDATA[UPDATE: April 29th 2008 Anders Baekgaard of Dicea ApS (current chan_ss7 maintainers) recommends the following alternative patch. Please note that mtp3d.c will also need to be patched in the same way: --- chan_ss7.c~ 2008-04-03 09:23:56.000000000 +0200 +++ chan_ss7.c 2008-04-29 08:29:20.000000000 +0200 @@ -249,11 +249,12 @@ static void dump_pcap(FILE *f, struct mtp_event *event) { + unsigned [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE: April 29th 2008</strong></p>
<p>Anders Baekgaard of <a href="dicea.dk">Dicea ApS</a> (current chan_ss7 maintainers) recommends the following alternative patch. Please note that <code>mtp3d.c</code> will also need to be patched in the same way:</p>
<pre>
--- chan_ss7.c~ 2008-04-03 09:23:56.000000000 +0200
+++ chan_ss7.c  2008-04-29 08:29:20.000000000 +0200
@@ -249,11 +249,12 @@

 static void dump_pcap(FILE *f, struct mtp_event *event)
 {
+  unsigned int sec  = event->dump.stamp.tv_sec;
   unsigned int usec  = event->dump.stamp.tv_usec -
     (event->dump.stamp.tv_usec % 1000) +
     event->dump.slinkno*2 + /* encode link number in usecs */
     event->dump.out /* encode direction in/out */;

-  fwrite(&#038;event->dump.stamp.tv_sec, sizeof(event->dump.stamp.tv_sec), 1, f);
+  fwrite(&#038;sec, sizeof(sec), 1, f);
   fwrite(&#038;usec, sizeof(usec), 1, f);
   fwrite(&#038;event->len, sizeof(event->len), 1, f); /* number of bytes of packet in file */
   fwrite(&#038;event->len, sizeof(event->len), 1, f); /* actual length of packet */
</pre>
<p><strong>END UPDATE: April 29th 2008</strong></p>
<p>A quickie for the Google trolls:</p>
<p>While trying to debug some SS7 Nature of Address (NAI) indication issues, I needed to use chan_ss7&#8242;s &#8216;dump&#8217; feature from the Asterisk CLI. It worked fine but the resultant pcap files always failed with messages like:</p>
<pre>
# tshark -r /tmp/now
tshark: "/tmp/now" appears to be damaged or corrupt.
(pcap: File has 409000-byte packet, bigger than maximum of 65535)
</pre>
<p>After much digging about and head-against-wall banging, I discovered the issue<br />
is with the packet header in the pcap file. It&#8217;s defined by its spec to be:</p>
<pre>
typedef struct pcaprec_hdr_s {
        guint32 ts_sec;         /* timestamp seconds */
        guint32 ts_usec;        /* timestamp microseconds */
        guint32 incl_len;       /* number of octets of packet saved in file */
        guint32 orig_len;       /* actual length of packet */
} pcaprec_hdr_t;
</pre>
<p>chan_ss7 uses the <code>timeval</code> struct defined by system headers to represent ts_sec and ts_usec. But, on 64bit machines (certainly mine), these values are defined as <code>unsigned long</code> rather than <code>unsigned int</code> (presumably as a step to get over the &#8216;year 2038 bug&#8217;). Hence the packet header is all wrong.</p>
<p>An easy solution is the following patch in <code>mtp.h</code>:</p>
<pre>
77a78,90
> /*
>  * The packet header in the pcap file (used for the CLI command 'dump') is
defined so has to
>  * have the two time components as unsigned ints. However, on 64bit
machines, the system
>  * timeval struct may use unsigned long. As such, we use a custom version
here:
>  */
> struct _32bit_timeval
> {
>   unsigned int tv_sec;            /* Seconds.  */
>   unsigned int tv_usec;      /* Microseconds.  */
> };
>
>
>
125c138
<       struct timeval stamp;        /* Timestamp */
---
>       struct _32bit_timeval stamp;        /* Timestamp */
</pre>
<p>There may be a better way &#8211; but this works.</p>
<p>This relates to chan_ss7-1.0.0 from <a href="http://www.dicea.dk/company/downloads">http://www.dicea.dk/company/downloads</a> and I have let them know also. It&#8217;s also a known issue for the Wireshark developers (although I did not investigate in detail to see what their resolution was for the future). See the following thread from 1999:</p>
<ul>
<li> <a href="http://www.ethereal.com/lists/ethereal-dev/199908/msg00065.html">http://www.ethereal.com/lists/ethereal-dev/199908/msg00065.html</a> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2008/04/28/chan_ss7-pcap-files-and-64bit-machines/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux on a Dell Vostro 200</title>
		<link>http://www.barryodonovan.com/index.php/2008/02/07/linux-dell-vostro-200</link>
		<comments>http://www.barryodonovan.com/index.php/2008/02/07/linux-dell-vostro-200#comments</comments>
		<pubDate>Thu, 07 Feb 2008 20:10:24 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[Recipes]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/index.php/2008/02/07/linux-dell-vostro-200/</guid>
		<description><![CDATA[Following a recent post to ILUG asking about setting Linux up on a Dell Vostro 200, I followed up with my notes from the time I had to do it a few months back. This is just a copy of my notes rather than a how-to but any competent Linux user should have no problem. [...]]]></description>
			<content:encoded><![CDATA[<p>Following <a href="http://mail.linux.ie/pipermail/ilug/2008-February/096736.html">a recent post</a> to <a href="http://mail.linux.ie/mailman/listinfo/ilug/">ILUG</a> asking about setting Linux up on a Dell Vostro 200, I <a href="http://mail.linux.ie/pipermail/ilug/2008-February/096741.html">followed up</a> with my notes from the time I had to do it a few months back.</p>
<p>This is just a copy of my notes rather than a how-to but any competent Linux user should have no problem. Apologies in advance for the brevity; with luck you&#8217;ll be using a later version of Linux which will already have solved the network issue&#8230; </p>
<p>The two main issues and fixes were:</p>
<ul>
<li> The SATA CD-ROM was not recognised initially and the fix was set the following parameter in the BIOS:
<p><code>BIOS -> Integrated Peripherals -> SATA Mode -> RAID</code></p>
<li> The network card is not recognised during a Linux install. Allow install to complete without network and then download Intel&#8217;s e1000 driver from <a href="http://downloadcenter.intel.com/">http://downloadcenter.intel.com/</a> or specifically <a href="http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&#038;Inst=Yes&#038;ProductID=839&#038;DwnldID=9180&#038;strOSs=39&#038;OSFullName=Linux*&#038;lang=eng">by clicking here</a>. The one I used then was e1000-7.6.9.tar.gz but the current version appears to be e1000-7.6.15.tar.gz (where the above link heads to &#8211; check for later versions).
<p>My only notes of the install just say &#8220;essentially follow instructions in README&#8221; so I assume they were good enough! Obviously you&#8217;ll need Linux kernel headers at least as well as gcc and related tools.</p>
<p>Once built and installed, a:</p>
<p><code>modprobe e1000</code></p>
<p>should have you working. Use <code>dmesg</code> to confirm.
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2008/02/07/linux-dell-vostro-200/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Recovering an LVM Physical Volume</title>
		<link>http://www.barryodonovan.com/index.php/2007/12/08/lvm-recovery</link>
		<comments>http://www.barryodonovan.com/index.php/2007/12/08/lvm-recovery#comments</comments>
		<pubDate>Sat, 08 Dec 2007 18:28:24 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[Recipes]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/index.php/2007/12/08/lvm-recovery/</guid>
		<description><![CDATA[Yesterday disaster struck &#8211; during a CentOS/RedHat installation, the installer asked (not verbatim): &#8220;Cannot read partition information for /dev/sda. The drive must be initialized before continuing.&#8221;. Now on this particular server, sda and sdb were/are a RAID1 (containing the OS) and a RAID5 partition respectively and sdc was/is a 4TB RAID5 partition from an externally [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday disaster struck &#8211; during a CentOS/RedHat installation, the installer asked (not verbatim): &#8220;Cannot read partition information for <tt>/dev/sda</tt>. The drive must be initialized before continuing.&#8221;.</p>
<p>Now on this particular server, <tt>sda</tt> and <tt>sdb</tt> were/are a RAID1 (containing the OS) and a RAID5 partition respectively and <tt>sdc</tt> was/is a 4TB RAID5 partition from an externally attached disk chassis. This was a server re-installation and all data from <tt>sda</tt> and <tt>sdb</tt> had multiple snapshots off site. <tt>sdc</tt> had no backups of its 4TBs of data.</p>
<p>The installer discovered the drives in a different order and <tt>sda</tt> became the externally attached drive. I, believing it to be the internal RAID1 array, allowed the installer to initialise it. Oh shit&#8230;</p>
<p>Now this wouldn&#8217;t be the end of the world. It wasn&#8217;t backed up because a copy of the data exists on removable drives in the UK. It would mean someone flying in with the drives, handing them off to me at the airport, bringing them to the data center and copying all the data back. Then returning the drives to the UK again. A major inconvenience. And it&#8217;s also an embarrassment as I should have ensured that <tt>sda</tt> is what I thought it was via the installers other screens.</p>
<p>Anyway &#8211; from what I could make out, the installer initialised the drive with a single partition spanning the entire drive.</p>
<p>Once I got the operating system reinstalled, I needed to try and recover the LVM partitions. There&#8217;s not a whole lot of obvious information on the Internet for this and hence why I&#8217;m writing this post.</p>
<p>The first thing I needed to do was recreate the physical volume. Now, as I said above, I had backups of the original operating system. LVM creates a file containing the metadata of each volume group in <tt>/etc/lvm/backup</tt> in a file named the same as the volume group name. In this file, there is a section listing the physical volumes and their ids that make up the volume group. For example (the id is fabricated):</p>
<pre>
physical_volumes {
        pv0 {
                id = "fvrw-GHKde-hgbf43-JKBdew-rvKLJc-cewbn"
                device = "/dev/sdc"     # Hint only

                status = ["ALLOCATABLE"]
                pe_start = 384
                pe_count = 1072319      # 4.09057 Terabytes
        }
}
</pre>
<p>Note that after I realised my mistake, I installed the OS on the correct partition and after booting, the external drive became <tt>/dev/sdc</tt><sup>*</sup> again. Now, to recreate the physical volume <strong>with the same id</strong>, I tried:</p>
<pre>
# pvcreate -u fvrw-GHKde-hgbf43-JKBdew-rvKLJc-cewbn /dev/sdc
  Device /dev/sdc not found (or ignored by filtering).
</pre>
<p>Eh? By turning on verbosity, you find the reason among a few hundred lines of debugging:</p>
<pre>
# pvcreate -vvvv -u fvrw-GHKde-hgbf43-JKBdew-rvKLJc-cewbn /dev/sdc
...
#filters/filter.c:121         /dev/sdc: Skipping: Partition table signature found
#device/dev-io.c:486         Closed /dev/sdc
#pvcreate.c:84   Device /dev/sdc not found (or ignored by filtering).
</pre>
<p>So pvcreate will not create a physical volume using the entire disk unless I remove partition(s) first. I do this with <tt>fdisk</tt> and try again:</p>
<pre>
# pvcreate -u fvrw-GHKde-hgbf43-JKBdew-rvKLJc-cewbn /dev/sdc
  Physical volume "/dev/sdc" successfully created
</pre>
<p>Great. Now to recreate the volume group on this physical volume:</p>
<pre>
# vgcreate -v md1000 /dev/sdc
    Wiping cache of LVM-capable devices
    Adding physical volume '/dev/sdc' to volume group 'md1000'
    Archiving volume group "md1000" metadata (seqno 0).
    Creating volume group backup "/etc/lvm/backup/md1000" (seqno 1).
  Volume group "md1000" successfully created
</pre>
<p>Now I have an &#8220;empty&#8221; volume group but with no logical volumes. I know all the data is there as the initialization didn&#8217;t format or wipe the drive. I&#8217;ve retrieved the LVM backup file called <tt>md1000</tt> and placed it in <tt>/tmp/lvm-md1000</tt>. When I try to restore it to the new volume group I get:</p>
<pre>
# vgcfgrestore -f /tmp/lvm-md1000 md1000
  /tmp/lvm-md1000: stat failed: Permission denied
  Couldn't read volume group metadata.
  Restore failed.
</pre>
<p>After a lot of messing, I copied it to <tt>/etc/lvm/backup/md1000</tt> and tried again:</p>
<pre>
# vgcfgrestore -f /etc/lvm/backup/md1000 md1000
  Restored volume group md1000
</pre>
<p>I don&#8217;t know if it was the location, the renaming or both but it worked. </p>
<p>Now the last hurdle is that on a <tt>lvdisplay</tt>, the logical volumes show up but are marked as:</p>
<pre>
  LV Status              NOT available
</pre>
<p>This is easily fixed by marking the logical volumes as available:</p>
<pre>
#  vgchange -ay
  2 logical volume(s) in volume group "md1000" now active
</pre>
<p>Agus sin é. My logical volumes are recovered with all data intact.</p>
<p><sup>*</sup> <em>how these are assigned is not particularly relevant to this story.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2007/12/08/lvm-recovery/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Amazon Web Service&#8217;s ec2-bundle-image on Ubuntu</title>
		<link>http://www.barryodonovan.com/index.php/2007/11/12/ec2-ami-ubuntu</link>
		<comments>http://www.barryodonovan.com/index.php/2007/11/12/ec2-ami-ubuntu#comments</comments>
		<pubDate>Mon, 12 Nov 2007 20:24:06 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/index.php/2007/11/12/ec2-ami-ubuntu/</guid>
		<description><![CDATA[This is really a post for Google&#8217;s crawlers on getting AWS&#8217;s EC2 AMI tools working under Ubuntu (I&#8217;m currently on Gutsy 7.10). Despite any bitching I may do below, EC2 and S3 are cool services. The first problem is that AWS only distribute the tools as an RPM (really guys? I mean FFS). Convert and [...]]]></description>
			<content:encoded><![CDATA[<p>
This is really a post for Google&#8217;s crawlers on getting AWS&#8217;s EC2 AMI tools working under Ubuntu (I&#8217;m currently on Gutsy 7.10). Despite any bitching I may do below, EC2 and S3 are cool services.
</p>
<p>
The first problem is that AWS only distribute the tools as an RPM (really guys? I mean FFS). Convert and install with <code>alien</code>.
</p>
<pre>
# apt-get install alien
# alien -k ec2-ami-tools.noarch.rpm
# dpkg -i ec2-ami-tools_1.3-15283_all.deb
</pre>
<p>
Make  sure you also install <code>libopenssl-ruby</code>.
</p>
<p>
Set your Ruby path as the RPM places them where RedHat expects to find them:
</p>
<pre>
# export RUBYLIB="/usr/lib/site_ruby"
</pre>
<p>
Now when you run the utility, you&#8217;ll probably get:
</p>
<pre>
$ ec2-bundle-image -r ... -i ... -k ... -c ... -u ...
sh: Syntax error: Bad substitution
</pre>
<p>
Aparently Ubuntu switched from invoking <code>bash</code> to <code>dash</code> for <code>sh</code> somewhere along the line. Just relink it (temporarily or permanently as suits):
</p>
<pre>
# rm /bin/sh
# ln -s /bin/bash /bin/sh
</pre>
<p>
And you should be good to go.
</p>
<p>
One other issue I encountered was that the permissions of the directories were for root only (i.e. <code>/usr/local/aes</code>, <code>/usr/lib/site_ruby/</code> and <code>/etc/aes</code>). A very sloppy <code>chmod a+rX</code> on each of these will resolve that. Although I suspect it&#8217;s more to do with the fact that I used <code>rpm2cpio</code> and <code>cpio</code> rather than <code>alien</code> the first time around.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2007/11/12/ec2-ami-ubuntu/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nagios Plugin to Check the Status of PRI Lines in Asterisk</title>
		<link>http://www.barryodonovan.com/index.php/2007/11/02/asterisk-pri-nagios</link>
		<comments>http://www.barryodonovan.com/index.php/2007/11/02/asterisk-pri-nagios#comments</comments>
		<pubDate>Fri, 02 Nov 2007 21:15:57 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[Recipes]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/index.php/2007/11/02/nagios-plugin-to-check-the-status-of-pri-lines-in-asterisk/</guid>
		<description><![CDATA[I have a number of Asterisk implementations that I keep an eye on that have multiple PRI connections. Knowing if and when they ever go down has the obvious benefits of alerting me to a problem in near real time. But besides that, it allows my customers and I to verify SLAs, track and log [...]]]></description>
			<content:encoded><![CDATA[<p>I have a number of Asterisk implementations that I keep an eye on that have multiple PRI connections. Knowing if and when they ever go down has the obvious benefits of alerting me to a problem in near real time. But besides that, it allows my customers and I to verify SLAs, track and log issues, etc.</p>
<p>To this end, I have written <a href="http://www.opensolutions.ie/misc/check_asterisk_pri.php.txt">a Nagios plugin</a> which queries Asterisk&#8217;s manager interface and executes the <code>pri show spans</code> CLI command (this is Asterisk 1.4 by the way). The script then parses the output to ascertain whether a PRI is up or not. </p>
<p>The actual code to connect to the manager interface and execute the query is simply:</p>
<pre>
if( ( $astsock = fsockopen( $host, $port, $errno, $errstr, $timeout ) ) === false )
{
    echo "Could not connect to Asterisk manager: $errstr";
    exit( STATUS_CRITICAL );
}

fputs( $astsock, "Action: Login\r\n");
fputs( $astsock, "UserName: $username\r\n");
fputs( $astsock, "Secret: $password\r\n\r\n"); 

fputs( $astsock, "Action: Command\r\n");
fputs( $astsock, "Command: pri show spans\r\n\r\n");

fputs( $astsock, "Action: Logoff\r\n\r\n");

while( !feof( $astsock ) )
{
    $asttext .= fread( $astsock, 8192 );
}

fclose( $astsock );

if( strpos( $asttext, "Authentication failed" ) !== false )
{
    echo "Asterisk manager authentication failed.";
    exit( STATUS_CRITICAL );
}
</pre>
<p>This plugin is hard coded to English and expects to find <code>Provisioned, Up, Active</code> for a good PRI. For example, the Asterisk implementations that support the <code>pri show spans</code> command that I have access to return one of:</p>
<ul>
<li> <code>PRI span 1/0: Provisioned, In Alarm, Down, Active</code> </li>
<li> <code>PRI span 3/0: Provisioned, Up, Active</code> </li>
</ul>
<p>I&#8217;m actually running a slightly older version of Nagios at the moment, version 1.3. To integrate the plugin, first add the following command definition to an appropriate existing or new file under <code>/etc/nagios-plugings/config/</code>:</p>
<pre>
define command{
        command_name    check_asterisk_pri
        command_line    /usr/lib/nagios/plugins/check_asterisk_pri.php \\
             -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ -w $ARG3$ \\
             -c $ARG4$ -n $ARG5$
}
</pre>
<p>where <code>$ARG1$</code> is the Asterisk manager username and <code>$ARG2$</code> is the password. <code>$ARG3$</code> and <code>$ARG4$</code> are the warning and critical thresholds respectively whereby if the number of available PRIs reaches one of these values, the appropriate error condition will be set. Lastly, <code>$ARG5$</code> is the number of PRIs the plugin should <string>expect</strong> to find. </p>
<p><strong>NB:</strong> the <code>command_line</code> line above is split for readability but it should all be on the one line.</p>
<p>Now create a test for a host in an appropriate file in <code>/etc/nagios/config/</code>:</p>
<pre>
define service{
        use                             core-service
        host_name                       hostname.domain.ie
        service_description             Asterisk PRIs
        check_command                   check_asterisk_pri!user!pass!2!1!4
}
</pre>
<p>Ensure that your Nagios server has permissions to access the Asterisk server via TCP on the Asterisk manager port (5038 by default). If on a public network, this should be done via stunnel or a VPN for security reasons. </p>
<p>Lastly, you&#8217;ll need a user with the appropriate permissions and host allow statements in your Asterisk configuration (<code>/etc/asterisk/manager.conf</code>):</p>
<pre>
[username]
secret = password
deny=0.0.0.0/0.0.0.0
permit=1.2.3.4/255.255.255.255
read = command
write = command
</pre>
<p>The next version may include support for BRI and Zap FXO ports also. I also plan on a Cacti plug in to show the channels on each PRI (up &#8211; on a call, down, etc). In any case, updates will be posted here.</p>
<p>The plug in can be download from: <a href="http://www.opensolutions.ie/misc/check_asterisk_pri.php.txt">http://www.opensolutions.ie/misc/check_asterisk_pri.php.txt</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2007/11/02/asterisk-pri-nagios/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Easy PHP Search in Firefox</title>
		<link>http://www.barryodonovan.com/index.php/2007/10/25/kde-shortcut</link>
		<comments>http://www.barryodonovan.com/index.php/2007/10/25/kde-shortcut#comments</comments>
		<pubDate>Thu, 25 Oct 2007 13:48:36 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[Recipes]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/index.php/2007/10/25/kde-shortcut/</guid>
		<description><![CDATA[Niall has created a quick Opensearch file to add the PHP Function search to the search bar of Firefox 2 And IE7. If anyone is interested it&#8217;s available here. For those that don&#8217;t know, this feature has existing in KDE in multiple forms for some time. For example, pressing ALT-F2 opens the Run Command dialog [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.moybella.net/">Niall</a> <a href="http://blog.moybella.net/2007/10/25/php-manual-open-search-for-firefox-2-and-ie7/">has created</a> a quick <a href="http://www.opensearch.org/">Opensearch</a> file to add the PHP Function search to the search bar of Firefox 2 And IE7. If anyone is interested it&#8217;s available <a href="javascript:window.external.AddSearchProvider('http://blog.moybella.net/uploads/php.xml');">here</a>.</p>
<p>For those that don&#8217;t know, this feature has existing in KDE in multiple forms for some time. For example, pressing ALT-F2 opens the <em>Run Command</em> dialog and typing, for example:</p>
<pre>
php:fopen
</pre>
<p>will bring up PHP.net&#8217;s own search page. The same goes for the location bar in Konqueror.</p>
<p>By the way, other nice short cuts in the <em>Run Command</em> dialog include:</p>
<ul>
<li> <code>gg: &lt;keywords&gt;</code> for a quick Google search; </li>
<li> <code>wp: &lt;keywords&gt;</code> for a quick Wikipedia search; </li>
<li> <code>dict: &lt;keyword&gt;</code> for a quick dictionary look-up; </li>
<li> <code>man: &lt;keyword&gt;</code> for a man page look-up; </li>
<li> <code>info: &lt;keyword&gt;</code> for an info page look-up; </li>
<li> <code>rfc: &lt;number&gt;</code> to be brought to the relevant RFC page; </li>
</ul>
<p>Of course, entering a command will execute it and just entering a URL will open it in Konqueror.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2007/10/25/kde-shortcut/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>lft :: Layer Four Trace</title>
		<link>http://www.barryodonovan.com/index.php/2007/10/23/lft</link>
		<comments>http://www.barryodonovan.com/index.php/2007/10/23/lft#comments</comments>
		<pubDate>Tue, 23 Oct 2007 09:03:57 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[OSS]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/index.php/2007/10/23/lft/</guid>
		<description><![CDATA[Colin pointed out a useful utility called lft in response to a question on IIU. lft looks like a useful alternative traceroute application as it claims to have the ability to identify stateful inspection firewalls and other useful information. What I found immediately attractive was the -A option which displays the AS numbers of addresses [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://colin.netech.ie">Colin</a> pointed out a useful utility called <code>lft</code> in <a href="http://www.fdntech.com/pipermail/iiu/2007q4/004907.html">response to a question</a> on <a href="https://www.fdntech.com/secure/mailman/listinfo/iiu">IIU</a>. <code>lft</code> looks like a useful alternative traceroute application as it claims to have the ability to identify stateful inspection firewalls and other useful information.</p>
<p>What I found immediately attractive was the <code>-A</code> option which displays the AS numbers of addresses along the path and also the <code>-N</code> which looks up and displays the network names.</p>
<p>e.g.</p>
<pre>
# lft -S -A  www.yahoo.com

TTL  LFT trace to f1.us.www.vip.ird.yahoo.com (87.248.113.14):80/tcp
 ...
 ...
 3   [AS35272] lns3.net.imagine.ie (87.232.0.26) 27.3ms
 4   [AS35272] ve5.core.net.imagine.ie (87.232.0.129) 9.0ms
 5   [AS35272] ge0-0.border1.net.imagine.ie (87.232.0.1) 8.6ms
 6   [AS3257] ge-2-0-0-207.dub20.ip.tiscali.net (213.200.67.145) 13.8ms
 7   [AS3257] yahoo-overture-gw2.dub20.ip.tiscali.net (213.200.67.202) 13.9ms
 8   [AS34010] ge-1-4.bas-b1.ird.yahoo.com (87.248.101.13) 10.9ms
 9   [AS34010] [target] f1.us.www.vip.ird.yahoo.com (87.248.113.14):80 12.6ms
</pre>
<p>and</p>
<pre>
# lft -S -N www.heanet.ie

TTL  LFT trace to www.heanet.ie (193.1.219.79):80/tcp
 ...
 ...
 3   [87-RIPE/IMAGINE-IRL] lns1.net.imagine.ie (87.232.0.24) 24.0ms
 4   [87-RIPE/IMAGINE-IRL] ve5.core.net.imagine.ie (87.232.0.129) 22.3ms
 5   [87-RIPE/IMAGINE-IRL] ge0-0.border1.net.imagine.ie (87.232.0.1) 60.6ms
 6   [RIPE-CBLK/IE-INEX-IPV4-PI-NETBLK1] gige6-1-cr1-cwt.hea.net (193.242.111.16) 8.7ms
 7   [RIPE-CBLK/HEANET-EXT] gige6-1-ar1-cwt.hea.net (193.1.195.177) 45.4ms
 8   [RIPE-CBLK/HEANET-EXT] blanch-sr1-po1.services.hea.net (193.1.195.139) 25.6ms
 9   [RIPE-CBLK/HEANET-LAN] [target] www.heanet.ie (193.1.219.79):80 9.4ms
</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2007/10/23/lft/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nagios Plugin for the Promise VTrak 200i</title>
		<link>http://www.barryodonovan.com/index.php/2007/06/06/nagios-promise-vtrak</link>
		<comments>http://www.barryodonovan.com/index.php/2007/06/06/nagios-promise-vtrak#comments</comments>
		<pubDate>Wed, 06 Jun 2007 20:03:53 +0000</pubDate>
		<dc:creator>Barry O'Donovan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[Recipes]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.barryodonovan.com/index.php/2007/06/06/nagios-promise-vtrak/</guid>
		<description><![CDATA[For a project I was working on, I installed a Promise VTrak M200i disk shelf (i for iSCSI but then that&#8217;s a whole other blog post!) and needed to add it into the customers management systems. Unfortunately there didn&#8217;t seem to be a lot of information out there on Promise&#8217;s SNMP MIBs so with a [...]]]></description>
			<content:encoded><![CDATA[<p>For a project I was working on, I installed a <a href="http://www.promise.com/product/product_detail_eng.asp?segment=VTrak&#038;product_id=151">Promise VTrak M200i</a> disk shelf (i for iSCSI but then that&#8217;s a whole other blog post!) and needed to add it into the customers management systems. </p>
<p>Unfortunately there didn&#8217;t seem to be a lot of information out there on Promise&#8217;s SNMP MIBs so with a bit of playing about, I was able to dig out the ones I needed. The Nagios plug-in I wrote and am making available here will monitor the shelf via SNMP and alert on the following chassis issues:</p>
<ul>
<li> critical if any of the shelf&#8217;s disk states changes from &#8220;OK&#8221;;
<li>
<li> warning if the battery state changes from &#8220;FullyCharged&#8221;; </li>
<li> critical if either of the PSU states change from &#8220;Powered On and Functional&#8221;; </li>
<li> critical is any of the cooling devices (fans) change from &#8220;Functional&#8221;; </li>
<li> critical if any of the temperature sensors&#8217; states change from &#8220;normal&#8221;; </li>
<li> critical if any of the drives go offline or are missing; and </li>
<li> warning if any of the drives go into the rebuilding state or have their PFA flag set. </li>
</ul>
<p>While this is specifically designed for a single M200i, it should be easily customisable for other models.</p>
<p>It can be downloaded from <a href="http://www.opensolutions.ie/misc/check_promise_chassis.pl">here</a> (<a href="http://www.opensolutions.ie/">http://www.opensolutions.ie/</a>). It will also appear on the <a href="http://www.barryodonovan.com/index.php/development/">development</a> section of this site and <a href="http://www.nagiosexchange.org/RAID_Controller.58.0.html?&#038;tx_netnagext_pi1[p_view]=1000&#038;tx_netnagext_pi1[page]=10%3A10">Nagios Plugins</a>.</p>
<h4>OIDs Used</h4>
<p></p>
<dl>
<dt><strong><tt>1.3.6.1.4.1.7933.1.10.2.1.1.1.8</tt></strong></dt>
<dd>The table of physical disk statuses.</dd>
<dt><strong><tt>.1.3.6.1.4.1.7933.2.1.7.1.1.14.1.1</tt></strong></dt>
<dd>The battery status.</dd>
<dt><strong><tt>.1.3.6.1.4.1.7933.2.1.4.1.1.2.1</tt></strong></dt>
<dd>The table of Power Supply Unit statuses.</dd>
<dt><strong><tt>.1.3.6.1.4.1.7933.2.1.3.1.1.3.1</tt></strong></dt>
<dd>The table of cooling device/fan statuses.</dd>
<dt><strong><tt>.1.3.6.1.4.1.7933.2.1.5.1.1.3</tt></strong></dt>
<dd>The table of temperature sensor statuses.</dd>
<dt><strong><tt>.1.3.6.1.4.1.7933.1.10.1.2.1.1.22.1</tt></strong></dt>
<dd>The number of drives that are offline.</dd>
<dt><strong><tt>.1.3.6.1.4.1.7933.1.10.1.2.1.1.23.1</tt></strong></dt>
<dd>The number of drives in the PFA status set.</dd>
<dt><strong><tt>.1.3.6.1.4.1.7933.1.10.1.2.1.1.24.1</tt></strong></dt>
<dd>The number of drives in rebuild status.</dd>
<dt><strong><tt>.1.3.6.1.4.1.7933.1.10.1.2.1.1.25.1</tt></strong></dt>
<dd>The number of drives that are missing.</dd>
</dl>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryodonovan.com/index.php/2007/06/06/nagios-promise-vtrak/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
