BarryODonovan.com

The thoughts, ramblings and rants of Barry O'Donovan

Categories

My Links

Search Posts


Amazon Web Service’s ec2-bundle-image on Ubuntu

November 12th, 2007 by Barry O'Donovan

This is really a post for Google’s crawlers on getting AWS’s EC2 AMI tools working under Ubuntu (I’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 install with alien.

# apt-get install alien
# alien -k ec2-ami-tools.noarch.rpm
# dpkg -i ec2-ami-tools_1.3-15283_all.deb

Make sure you also install libopenssl-ruby.

Set your Ruby path as the RPM places them where RedHat expects to find them:

# export RUBYLIB="/usr/lib/site_ruby"

Now when you run the utility, you’ll probably get:

$ ec2-bundle-image -r ... -i ... -k ... -c ... -u ...
sh: Syntax error: Bad substitution

Aparently Ubuntu switched from invoking bash to dash for sh somewhere along the line. Just relink it (temporarily or permanently as suits):

# rm /bin/sh
# ln -s /bin/bash /bin/sh

And you should be good to go.

One other issue I encountered was that the permissions of the directories were for root only (i.e. /usr/local/aes, /usr/lib/site_ruby/ and /etc/aes). A very sloppy chmod a+rX on each of these will resolve that. Although I suspect it’s more to do with the fact that I used rpm2cpio and cpio rather than alien the first time around.

Posted in Linux, OSS, Rants, Software | 1 Comment »

Blacknight “to IPv6 the Irish Internet!”

November 6th, 2007 by Barry O'Donovan

Over in Blacknight’s blog, Paul tells us how they are going to IPv6 the Irish Internet!. Well done lads!.

In Ireland, a lot of the ISPs actually have IPv6 enabled their network edges – this includes imag!ne (aka Gaelic Telecom), HEAnet, BT Ireland, Eircom, Irish Broadband and Smart Telecom. Some of these companies offer IPv6 to their customers but a lot don’t or only on a trial basis.

Why? Well the simple answer is there’s no need. There is just no substantive quantity of content available on IPv6 so ISP customers have no need to have or even know about IPv6. This is why Blacknight’s announcement is so exciting. Paul Kelly, CTO, is setting an ambitious but attainable target of 30,000 Irish websites to be reached over IPv6 by the end of 2008.

Paul also goes on to explain just some of the possible (and serious) consequences if ISPs don’t start making progress towards IPv6-enabling their networks. And his announcement has given me that added impetus to get my finger out.

As members of INEX (Irish Neutral Internet Exchange) Blacknight is the only content provider to date that actively seeks to peer with the other members over IPv6. It would be great if INEX added IPv6 peerings to their peering matrix as a further promotional tool. All the ISPs I mentioned above are also actively peering over IPv6 at INEX.

For anyone who’d like to know more about IPv6, ICANN have posted a factsheet – a clear guide to a technical subject written in plain English – on IPv6 here.

Lastly, to inject a little (geek) humour, at the recent RIPE meeting (RIPE 55), an attendee by the name of Gary Feldman broke up proceedings with a rendition of he’s parody The Day the Routers Died:



Oh, and speaking of content and incentives, *cough* see here *cough*.

Posted in Networking, News, Politics | 1 Comment »

Nagios Plugin to Check the Status of PRI Lines in Asterisk

November 2nd, 2007 by Barry O'Donovan

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.

To this end, I have written a Nagios plugin which queries Asterisk’s manager interface and executes the pri show spans 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.

The actual code to connect to the manager interface and execute the query is simply:

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 );
}

This plugin is hard coded to English and expects to find Provisioned, Up, Active for a good PRI. For example, the Asterisk implementations that support the pri show spans command that I have access to return one of:

  • PRI span 1/0: Provisioned, In Alarm, Down, Active
  • PRI span 3/0: Provisioned, Up, Active

I’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 /etc/nagios-plugings/config/:

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$
}

where $ARG1$ is the Asterisk manager username and $ARG2$ is the password. $ARG3$ and $ARG4$ 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, $ARG5$ is the number of PRIs the plugin should expect to find.

NB: the command_line line above is split for readability but it should all be on the one line.

Now create a test for a host in an appropriate file in /etc/nagios/config/:

define service{
        use                             core-service
        host_name                       hostname.domain.ie
        service_description             Asterisk PRIs
        check_command                   check_asterisk_pri!user!pass!2!1!4
}

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.

Lastly, you’ll need a user with the appropriate permissions and host allow statements in your Asterisk configuration (/etc/asterisk/manager.conf):

[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

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 – on a call, down, etc). In any case, updates will be posted here.

The plug in can be download from: http://www.opensolutions.ie/misc/check_asterisk_pri.php.txt

Posted in Linux, OSS, Recipes, Software, VoIP | 5 Comments »

Easy PHP Search in Firefox

October 25th, 2007 by Barry O'Donovan

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’s available here.

For those that don’t know, this feature has existing in KDE in multiple forms for some time. For example, pressing ALT-F2 opens the Run Command dialog and typing, for example:

php:fopen

will bring up PHP.net’s own search page. The same goes for the location bar in Konqueror.

By the way, other nice short cuts in the Run Command dialog include:

  • gg: <keywords> for a quick Google search;
  • wp: <keywords> for a quick Wikipedia search;
  • dict: <keyword> for a quick dictionary look-up;
  • man: <keyword> for a man page look-up;
  • info: <keyword> for an info page look-up;
  • rfc: <number> to be brought to the relevant RFC page;

Of course, entering a command will execute it and just entering a URL will open it in Konqueror.

Posted in Linux, OSS, Recipes, Software | 3 Comments »

If architects had to work like programmers…

October 25th, 2007 by Barry O'Donovan

A friend sent me this link today. It’s too true to be funny:

http://www.pcuf.fi/~pjt/pink/software-architecture.html

Posted in Links, Rants | 1 Comment »

« Previous Entries Next Entries »