[asterisk-users] Monitoring Asterisk uptime

Myles Wakeham myles at techsol.org
Thu Aug 6 11:01:41 CDT 2009


David writes:

 >How about a shell script on the monitoring server:

 >#!/bin/sh
 >trunk=`ssh asterisk at astbox "asterisk -r -x 'sip show registry' | grep 
 >USERNAME"`

 >state=`echo $trunk | awk '{print $4}'

 >if state is 'Registered', yay!

 >else, UHOH!

 >EOF

 >Based on that ssh/shell script framework (you'd obviously need host 
 >keys to do this without user interation), you should be able to poll 
 >any linux server for really anything you want.

 >Someone who is in the business of selling hosted applications should 
be >able to EASILY use awk and grep to figure out if his sip trunks are 
in >the 'Registered' state via SSH... Unless I misunderstood the nature 
of >your question and you were looking for something native to asterisk 
or >the AMI.

Thanks for the feedback, and its a good idea!  We are monitoring about 
45 servers right now with some 3rd party monitoring software, and 
looking to move it all to Nagios.  Unfortunately our currently software 
doesn't give me as much flexibility on a per device basis to have it 
execute a script for each device that its monitoring to this level, but 
I'm thinking that we could customize Nagios to do this sort of thing.

Its definitely worth exploring and I'll post back with the results.

Thanks again.

Myles

-- 
=======================
Myles Wakeham
Director of Engineering
Tech Solutions USA, Inc.
Scottsdale, Arizona  USA
http://www.techsolusa.com
Phone +1-480-451-7440




More information about the asterisk-users mailing list