Monday, June 8, 2009

Nagios Asterisk channels plugin

I have downloaded the plugin check_ast_chan from internet. This plugin checks the total number of active calls on asterisk. When i ran it from command line , it worked but was not working from nagios server. Nagios server was not showing the channle count. So I modified it liitle and it is working now. The modified code is below:


#!/bin/bash

# Polls the asterisk server and returns active channel information


echo `/usr/sbin/asterisk -rx "show channels" | tail -3 | grep active | sed '$!N;s/\n/ /'` > /home/astchannels
rc=0
if [ "$?" -ne 0 ]
then
mesg="Error in Asterisk check"
rc=3
fi
cat /home/astchannels
exit $rc



This code works 100%. I have checked it with nagios-3.0.6, nagios-plugins-1.4.13, nrpe-2.12 on centos 5.1

No comments:

Post a Comment