Hey Guys, I'm after a way to monitor our sip trunks (peers) and send an email if they go down. I know I could use 'asterisk -rx "sip show peers"' in a shell script but that seems messy, especially since I'd like to monitor it fairly closely (so I'd like to run it every 20 or 30 seconds or so). Is there a better way to do it?
On Fri, 2011-02-04 at 15:43 +1000, Ryan Tucker wrote:> Hey Guys, > > I'm after a way to monitor our sip trunks (peers) and send an email if they go down. > I know I could use 'asterisk -rx "sip show peers"' in a shell script but that seems messy, > especially since I'd like to monitor it fairly closely (so I'd like to run it every 20 or 30 seconds or so). > Is there a better way to do it? > > --Just a thought... I presume, correct me if i'm wrong, that if a peer goes down, it will be completely unreachable, and not just the sip-part? If so, i would have a look at the general management tools, like OpenNMS Theses can monitor the presence, by means of ICMP, and can send alerts. If not, you can still use OpenNMS, but you have to write a simpel (..) script, like the line above (with some glue) so you can either read asterisk out by means of snmp, or generate snmp-traps when a peer fails. (perhaps these already exists?)
On Fri, Feb 04, 2011 at 03:43:00PM +1000, Ryan Tucker wrote:> I'm after a way to monitor our sip trunks (peers) and send an email if > they go down. I know I could use 'asterisk -rx "sip show peers"' in a > shell script but that seems messy, especially since I'd like to > monitor it fairly closely (so I'd like to run it every 20 or 30 > seconds or so). Is there a better way to do it?What is messy about it? An alternative would be to get the same info by using AMI (using a persistent connection if you'd like), but if you go for the AMI way you could implement an event listener for PeerStatus changes: http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Events -- Daniel Tryba