Script to Monitor E1/BRI Channel Usage
Moderators: Developers, Moderators
-
- Posts: 17
- Joined: Wed Jun 22, 2005 10:43 pm
Script to Monitor E1/BRI Channel Usage
Hi
I'm sure this question has been asked a couple of times ... I am trying to graph the amount of inbound and outbound voice calls on a Cisco router. Cisco provides a CISCO−POP−MGMT−MIB http://www.cisco.com/en/US/tech/tk648/t ... be59.shtml to collect this info from there AS5xxx servers, but this MIB doesn't populate on their other range of voice routers.
I am trying to locate a script that will:
1. snmpwalk a router and return the "isdnBearerOperStatus"
2. Count all results equalling "active (4)"
3. Return a numeric value which can be graphed in Cacti.
For example, the following output would return a result of "2" ...
[root@cacti/]# snmpwalk -v1 -c public 10.1.1.1 .1.3.6.1.2.1.10.20.1.2.1.1.2
ISDN-MIB::isdnBearerOperStatus.103 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.104 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.107 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.108 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.111 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.112 = INTEGER: idle(1)
I'm sure that if someone has some spare time to create a perl or sh script to achieve this functionality it would benefit many people in the VoIP world
I tried playingaround with existing "ping.pl" and a few other scripts ... but didn't have a clue what I was doing
TIA
I'm sure this question has been asked a couple of times ... I am trying to graph the amount of inbound and outbound voice calls on a Cisco router. Cisco provides a CISCO−POP−MGMT−MIB http://www.cisco.com/en/US/tech/tk648/t ... be59.shtml to collect this info from there AS5xxx servers, but this MIB doesn't populate on their other range of voice routers.
I am trying to locate a script that will:
1. snmpwalk a router and return the "isdnBearerOperStatus"
2. Count all results equalling "active (4)"
3. Return a numeric value which can be graphed in Cacti.
For example, the following output would return a result of "2" ...
[root@cacti/]# snmpwalk -v1 -c public 10.1.1.1 .1.3.6.1.2.1.10.20.1.2.1.1.2
ISDN-MIB::isdnBearerOperStatus.103 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.104 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.107 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.108 = INTEGER: idle(1)
ISDN-MIB::isdnBearerOperStatus.111 = INTEGER: active(4)
ISDN-MIB::isdnBearerOperStatus.112 = INTEGER: idle(1)
I'm sure that if someone has some spare time to create a perl or sh script to achieve this functionality it would benefit many people in the VoIP world
I tried playingaround with existing "ping.pl" and a few other scripts ... but didn't have a clue what I was doing
TIA
- kjmattakat
- Posts: 15
- Joined: Fri Oct 12, 2007 3:03 pm
cisco active calls on PRI
I have wanted to graph active calls per PRI on a voice gateway and have not found any MIBs that will do this.
I ended up writing a perl script that will ssh to the router, parse responses to show commands and then return number of active calls. It worked well enough for me and covers multiple PRIs on a gateway.
I am no perl guru, so i am sure there is a better way to handle the ssh. I had to run it once manually on the cacti server when adding the gateway before it would store the key, then it worked fine everytime. I am sure someone more advanced in perl could fix that.
below is a graph, i can export the template and script if anyone is interested. I am running cacti on windows so this is using the w32perl SSh package.
I ended up writing a perl script that will ssh to the router, parse responses to show commands and then return number of active calls. It worked well enough for me and covers multiple PRIs on a gateway.
I am no perl guru, so i am sure there is a better way to handle the ssh. I had to run it once manually on the cacti server when adding the gateway before it would store the key, then it worked fine everytime. I am sure someone more advanced in perl could fix that.
below is a graph, i can export the template and script if anyone is interested. I am running cacti on windows so this is using the w32perl SSh package.
- Attachments
-
- graph query
- calls2.JPG (25.08 KiB) Viewed 26558 times
-
- graph
- calls.JPG (90.92 KiB) Viewed 26564 times
Re: cisco active calls on PRI
Please share your template and the script.kjmattakat wrote:below is a graph, i can export the template and script if anyone is interested. I am running cacti on windows so this is using the w32perl SSh package.
Thanks,
AL
- kjmattakat
- Posts: 15
- Joined: Fri Oct 12, 2007 3:03 pm
I just did an export on the data query template, think that included the other templates, let me know.
The query xml and the perl script are in the sub folders.
you will need to change the $ENV{HOME} to point where you want your keys stored, and change the username and password of course.
Hopefully it works for you. Like i said, i have not had any problems with it. I poll some gateways at 1 min and others at 5 min.
I had to run it once from a command prompt on the cacti server for each gateway i wanted to manage prior to adding the graphs to the gateway. (perl Cisco_Calls.pl <ip_address> index)
FYI - The script pulls the "description" from the T1 controller config.
The query xml and the perl script are in the sub folders.
you will need to change the $ENV{HOME} to point where you want your keys stored, and change the username and password of course.
Hopefully it works for you. Like i said, i have not had any problems with it. I poll some gateways at 1 min and others at 5 min.
I had to run it once from a command prompt on the cacti server for each gateway i wanted to manage prior to adding the graphs to the gateway. (perl Cisco_Calls.pl <ip_address> index)
FYI - The script pulls the "description" from the T1 controller config.
- Attachments
-
- calls.zip
- (5.13 KiB) Downloaded 1802 times
I have a problem - I have multiple PRI (E1 controllers) but it shows me only the first PRI - the rest are not shown:
after clicking on VERBOSE QUERY getting this:
But I have more PRI on that device (at the moment 4 PRI, two of them are UP and runnign, two of them are down).
Any help to show another PRI's ?
edited;
at cacti's log file found this:
fix: it should be 1/0:15 at the end - where to change it ?
and this for the same router:
Code: Select all
Cisco Active Gateway Calls (Verbose Query) Uptime Goes Backwards Success [3 Items, 1 Row]
Code: Select all
+ Running data query [14].
+ Found type = '4 '[script query].
+ Found data query XML file at '/home/www/cacti/resource/script_queries/Cisco_Calls.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'perl /home/www/cacti/scripts/Cisco_Calls.pl xxxxxxxxxx index'
+ Executing script query 'perl /home/www/cacti/scripts/Cisco_Calls.pl xxxxxxxxxx query index'
+ Found item [Index='0/0/0:23'] index: 0/0/0:23
+ Executing script query 'perl /home/www/cacti/scripts/Cisco_Calls.pl xxxxxxxxxx query name'
+ Found item [name='Serial0/0/0:23'] index: 0/0/0:23
+ Executing script query 'perl /home/www/cacti/scripts/Cisco_Calls.pl xxxxxxxxxx query description'
+ Found item [descr=''] index: 0/0/0:23
+ Found data query XML file at '/home/www/cacti/resource/script_queries/Cisco_Calls.xml'
+ Found data query XML file at '/home/www/cacti/resource/script_queries/Cisco_Calls.xml'
+ Found data query XML file at '/home/www/cacti/resource/script_queries/Cisco_Calls.xml'
+ Found data query XML file at '/home/www/cacti/resource/script_queries/Cisco_Calls.xml'
Any help to show another PRI's ?
edited;
at cacti's log file found this:
Code: Select all
ERROR: Empty result [xxxxxx]: 'perl /home/www/cacti/scripts/Cisco_Calls.pl xxxxxx get activeCount 1/0:23'
and this for the same router:
Code: Select all
Empty result [xxxxxx]: 'perl /home/www/cacti/scripts/Cisco_Calls.pl xxxxxx get index 1/0:23'
- kjmattakat
- Posts: 15
- Joined: Fri Oct 12, 2007 3:03 pm
I only use T1 PRI so the script was set up for D channel on channel 23. I have edited the script to look for the ISDN D channel instead of the serial interface, probably a better way of doing it anyway.
i have attached the new script, run it from the command line first to see what you get, appeared to work for me.
Also, the description is pulled from the 'show controller t1/e1' info, i attempted to make this work with either T1 or E1 based on if the D channel was either 15 or 23. Again this worked for me but i only have T1. Please let me know if all goes well for you.
- Remember to change the $ENV{HOME} and user and password.
i have attached the new script, run it from the command line first to see what you get, appeared to work for me.
Also, the description is pulled from the 'show controller t1/e1' info, i attempted to make this work with either T1 or E1 based on if the D channel was either 15 or 23. Again this worked for me but i only have T1. Please let me know if all goes well for you.
- Remember to change the $ENV{HOME} and user and password.
- Attachments
-
- Cisco_Calls.pl
- v0.9.1 (add E1)
- (1.73 KiB) Downloaded 963 times
- kjmattakat
- Posts: 15
- Joined: Fri Oct 12, 2007 3:03 pm
Update:
I added the 'controller' name for the query. Nothing major, should be pretty obvious but might be nice to see in the query.
Here is the new script and xml
I added the 'controller' name for the query. Nothing major, should be pretty obvious but might be nice to see in the query.
Here is the new script and xml
- Attachments
-
- Cisco_Calls.pl
- v0.9.2 (controller name)
- (1.91 KiB) Downloaded 1225 times
-
- Cisco_Calls.xml
- resource-query_scripts XML file
- (1.16 KiB) Downloaded 1339 times
-
- graphcalls.jpg (88.97 KiB) Viewed 26034 times
-
- querycalls.jpg (25.9 KiB) Viewed 26034 times
not really
when using E1 the serial interface is also named: serial x/x:23
Only you must change :23 to :15 like this (sorry I am not a programmer) when checking active calls.
why ? because the cmd is like that: show voice call x/x:15
I will post all my changes when see that script working correctly
when using E1 the serial interface is also named: serial x/x:23
Only you must change :23 to :15 like this (sorry I am not a programmer) when checking active calls.
Code: Select all
my ($spr1, $spr2) = split (':',$intx);
$intx = $spr1.':15';
I will post all my changes when see that script working correctly
- kjmattakat
- Posts: 15
- Joined: Fri Oct 12, 2007 3:03 pm
- kjmattakat
- Posts: 15
- Joined: Fri Oct 12, 2007 3:03 pm
- kjmattakat
- Posts: 15
- Joined: Fri Oct 12, 2007 3:03 pm
My mistake - of course it is working with :15 in Europe forgive my ignorance but as I wrote before I am not a programmer and I can make only simple changes in the script..
=====
about the TELNET - download cisco telnet tools:
use Net::Telnet::Cisco;
my $telnet_session = Net::Telnet::Cisco->new(Host => $h);
$telnet_session->login($user, $pass);
=====
about the TELNET - download cisco telnet tools:
use Net::Telnet::Cisco;
my $telnet_session = Net::Telnet::Cisco->new(Host => $h);
$telnet_session->login($user, $pass);
Who is online
Users browsing this forum: No registered users and 2 guests