[asterisk-users] way to inquire status of T1 link

Jonathan C. Bailey jbailey at co.marshall.ia.us
Sat Apr 12 20:27:31 CDT 2008


We use Nagios for network monitoring. We've got a check_pri script that should be fairly universal. It will return "critical" for any alarm. Feel free to use the script as you see fit. YMMV - may skin cats, etc (you know the disclaimer drill)... 


#! /usr/bin/python

# Checks PRI status - returns similar to the following:
# PRI span 1/0: Provisioned, Up, Active / PRI span 2/0: Provisioned, Up, Active


import os, sys, socket

statusstring = ''

for file in os.popen('/usr/sbin/asterisk -rx "pri show spans"').readlines():
        out = file[:-1]
        if out.startswith('PRI'):
                statusstring += ' / ' + out.strip()
        if out.startswith('Unable to connect to remote asterisk'):
                print "Unable to connect to Asterisk instance"
                sys.exit(2)

print statusstring.strip()[2:]

if statusstring.strip()[2:].count("In Alarm") > 0:
        sys.exit(2)

# Nagios Return Codes
# OK = 0
# Warning = 1
# Critical = 2
# Unknown = 3

sys.exit(0)



-Jon

----- Original Message -----
From: "Alex Balashov" <abalashov at evaristesys.com>
To: "Asterisk Users Mailing List - Non-Commercial Discussion" <asterisk-users at lists.digium.com>
Sent: Saturday, April 12, 2008 8:21:09 PM GMT -06:00 US/Canada Central
Subject: Re: [asterisk-users] way to inquire status of T1 link

Jerry Geis wrote:
> Is there a way to inquire of the T1 link status?
> 
> I mean having cron (as example) execute a program that asks if the T1 
> status is OK.YEL or RED?
> then on RED I can send some alert?

What sort of adaptor?

-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599

_______________________________________________
-- 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



More information about the asterisk-users mailing list