Hi I am trying to implement monitoring of asterisk (all 4 spans-i want to show them line by line Up or down) using nagios using below script, but i always get the status as down and red..can anyone let me know how to read an output from nagios plugin ? nagios etc is configured already and is working PATH=/bin:/sbin:/usr/bin:/usr/sbin FAILS="" SPANS=$(asterisk -rnx "pri show span 1" | grep -a PRI | awk '{print $3;}' | cut -d"/" -f1) STATUS=$(asterisk -rnx "pri show span 1" | grep -a Status | awk '{print $3;}' | cut -d, -f1) if [ $STATUS == "Up" ]; then FAILS= "UP" else FAILS="Down" fi if [ $FAILS != "UP" ]; then echo "ISDN Lines down" exit 2 fi echo "ISDN OK " exit 0 If anyone can share the above script for asterisk monitoring then i wud be grateful rgds Sriram -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090618/7154eaf2/attachment.htm
*FAILS= "UP"* should be *FAILS="UP"* (without the space) it is a syntax error and if you test the script in console you will notice it immediately. On Wed, Jun 17, 2009 at 2:34 PM, Sriram <d_r_sriram at hotmail.com> wrote:> Hi > I am trying to implement monitoring of asterisk (all 4 spans-i want to show > them line by line Up or down) using nagios using below script, but i always > get the status as down and red..can anyone let me know how to read an output > from nagios plugin ? nagios etc is configured already and is working > > PATH=/bin:/sbin:/usr/bin:/usr/sbin > FAILS="" > SPANS=$(asterisk -rnx "pri show span > 1" | grep -a PRI | awk '{print $3;}' | cut -d"/" -f1) > > > STATUS=$(asterisk -rnx "pri show span 1" | grep -a Status | awk '{print $3;}' | cut -d, -f1) > > if [ $STATUS == "Up" ]; then > FAILS= "UP" > > else > FAILS="Down" > fi > > if [ $FAILS != "UP" ]; then > echo "ISDN Lines down" > exit 2 > fi > > echo "ISDN OK " > exit 0 > If anyone can share the above script for asterisk monitoring then i wud be > grateful > > rgds > Sriram > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090617/f14bcc1f/attachment.htm
On Thu, Jun 18, 2009 at 12:04:26AM +0530, Sriram wrote:> Hi > I am trying to implement monitoring of asterisk (all 4 spans-i want to show them line by line Up or down) using nagios using below script, but i always get the status as down and red..can anyone let me know how to read an output from nagios plugin ? nagios etc is configured already and is working > > PATH=/bin:/sbin:/usr/bin:/usr/sbin > FAILS="" > SPANS=$(asterisk -rnx "pri show span 1" | grep -a PRI | awk '{print $3;}' | cut -d"/" -f1)SPANS=$(ls /proc/dahdi /proc/zaptel 2>/dev/null) -- Tzafrir Cohen icq#16849755 jabber:tzafrir.cohen at xorcom.com +972-50-7952406 mailto:tzafrir.cohen at xorcom.com http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir