11.01.2009

Nagios Asterisk IAX2 POKE with check_asterisk.pl

It seems that since around Asterisk 1.4.26.2 the Nagios contrib plugin check_asterisk has stopped working for the "iax ping" feature. I turned on iax debugging in Asterisk and did a packet capture. Seems like the only reason why it worked was because it sent a 0x06 REJECT frame and Asterisk would reply with invalid. I changed it to send a 0x1e POKE request and submitted a small patch to fix this in the plugin. I seriously doubt the Nagios Plugins team will do anything with it since there's no upstream maintainer and it's in the contrib directory so here's the patch:


--- check_asterisk.pl 2009-09-24 03:13:56.000000000 -0700
+++ check_asterisk.pl.changed 2009-11-01 13:10:06.000000000 -0800
@@ -31,7 +31,8 @@
my $iax_timestamp = "00000000";
my $iax_outbound_seq = "00";
my $iax_inbound_seq = "00";
-my $iax_type = "06"; #IAX_Control
+my $iax_type = "06"; #IAX_Control
+my $iax_frame_value = "1e"; #POKE

sub ok {
$s = shift;
@@ -224,7 +225,7 @@
socket(PING, PF_INET, SOCK_DGRAM, getprotobyname("udp"));

$msg = pack "H24", $iax_src_call . $iax_dst_call . $iax_timestamp .
- $iax_outbound_seq . $iax_inbound_seq . $iax_type . $iax_type;
+ $iax_outbound_seq . $iax_inbound_seq . $iax_type . $iax_frame_value ;

$ipaddr = inet_aton($host);
$sendto = sockaddr_in($port,$ipaddr);


You should also check out this patch that adds performance data to the Nagios plugin. Good for graphing channel usage over time.

References:
* IAX2 RFC Document
* Nagios Plugins
* Bug/Patch Report

7 comments:

Mary Starr said...

Hello,
I am wondering if you would be interested in maintaining this plugin. If so, can you add it to the Nagios Exchange site so others can possibly benefit also? Many thanks, Mary
http://exchange.nagios.org

Ernesto said...

Mary - the plugin is included in the official Nagios Plugins project, these are just patches to improve functionality. I will try to approach the Nagios Plugins maintainers with my patches (and others). Cheers to you and "the father".

Ernesto said...

Mary Starr -

Actually it looks like this made it into the Nagios Plugins mailing lists (http://news.gmane.org/gmane.network.nagios.plugins.devel), though I imagine it will be largely ignored along with a more important patch that a peer wrote (https://sourceforge.net/tracker/index.php?func=detail&aid=2814784&group_id=29880&atid=397599). Oh and not to mention this little bug in the config I pointed out (http://tracker.nagios.org/view.php?id=14) also ignored.

It's nice that you're going around encouraging people to contribute, however it's very discouraging with the current systems/maintainers that are set up. If you want the community to help, I suggest organizing the project to promote such things, not discourage them.

Anonymous said...
This comment has been removed by a blog administrator.
karl said...
This comment has been removed by a blog administrator.
Anonymous said...

Today is my lucky day :)
Apple is giving review copies of iPad to 100 lucky person. Go to http://bit.ly/d9QOON and apply for it.

Anonymous said...

thx man.. this really helepd.. was scrathcing my head for a few hours.. u rock