Trunkmonitor

General discussions about Asterisk.

Moderators: Moderator, Support

Trunkmonitor

Postby mathabathe » Wed Nov 18, 2015 5:29 am

Hi , I have just build asterisk 1.8 test machine on centos 6.i want to monitor all the trunks ,iax,sip and Dadhi.however the agi-bin directoty is empty. cd /var/lib/asterisk/agi-bin

I want to edit the file /var/lib/asterisk/agi-bin/trunkmonitor but is it not there.

thank you in advance
mathabathe
Newsterisk
 
Posts: 22
Joined: Thu Apr 03, 2014 12:45 am

Re: Trunkmonitor

Postby abw1oim » Wed Nov 18, 2015 6:04 am

The mantioned Skript is not part of the vanilla Asterisk. It's a private addition some giy made for it's personal purpose. Just ask this guy http://pbxinaflash.com/community/index.php?threads/sip-iax-trunk-monitor-script.5271/
Olaf Winkler
Asterisk- & Database-Solutions
abw1oim
Oldsterisk
 
Posts: 358
Joined: Fri Aug 05, 2011 1:00 am
Location: Germany

Re: Trunkmonitor

Postby mathabathe » Mon Nov 23, 2015 1:23 am

thank you , i have the script , my problem is that , i dont have file trunkmonitor.

cd /var/lib/asterisk/agi-bin is empty
mathabathe
Newsterisk
 
Posts: 22
Joined: Thu Apr 03, 2014 12:45 am

Re: Trunkmonitor

Postby mathabathe » Tue Dec 08, 2015 9:53 am

Hi I got the script as follows and it works on SIP AND IAX TRUNKS
ZAP TRUNKS IS NOT WORKING


#!/usr/bin/perl

################################################## ################################################## ###########################
####
#### Trunk Alerts script written by Jim Hribnak Oct 7th 2007
#### if there is any questions please feel free to drop me an email at jimh at domain nucleus.com
#### Called using Cron job

################################################## ################################################## ###########################
####
#### Create the following 2 files in /etc/asterisk
####
#### in the files below add the hosts entry from asterisk -rx "sip show registry" and
#### from asterisk -rx "iax2 show registry".
####

open(IAXTRUNKS,"/etc/asterisk/trunkalerts_iax.txt");
open(SIPTRUNKS,"/etc/asterisk/trunkalerts_sip.txt");
open(ZAPTRUNKS,"/etc/asterisk/trunkalerts_zap.txt");

################################################## ################################################## ###########################
####
#### ZAP Related Code
####

#print "================================================= ===========\n";
#print "ZAP Trunk information\n";
#print "================================================= ===========\n";

while (<ZAPTRUNKS>) {
chomp;
$zaptrunks = `/usr/sbin/asterisk -rx "dahdi show status" |grep \"$_\" | awk '{print $2}'`;
print "zaptrunks = $zaptrunks\n";
if ($zaptrunks =~ "OK") {
print "$_ is up\n" ;

} else {
print "We have a problem\n";
print "$_ trunk is not registering\n";
mailalert();

}
} #end of while loop (read ZAP file)

and when i ran the script as follows
root@asterisk]# /var/lib/asterisk/agi-bin/trunkmonitor
I get the following results below:

zaptrunks =
We have a problem
trunk is not registering
An email has been sent!

zaptrunks =
We have a problem
trunk is not registering
An email has been sent!

zaptrunks =
We have a problem
trunk is not registering
An email has been sent!

zaptrunks =
We have a problem
trunk is not registering
An email has been sent!

i have text file as follows:
vim /etc/asterisk/trunkalerts_zap.txt

T4XXP (PCI) Card 0 Span 1
T4XXP (PCI) Card 0 Span 2
T4XXP (PCI) Card 0 Span 3
T4XXP (PCI) Card 0 Span 4
mathabathe
Newsterisk
 
Posts: 22
Joined: Thu Apr 03, 2014 12:45 am

Re: Trunkmonitor

Postby navaismo » Tue Dec 08, 2015 3:35 pm

Contact the person who wrote it, you have the email at the top of your file. In the other hand a Quick View the script are looking for "OK" values, while your file doesn't contain it.
navaismo
Salt of the Asterisk
 
Posts: 1610
Joined: Mon Dec 07, 2009 1:30 pm
Location: Mexico City, Mexico

Re: Trunkmonitor

Postby mathabathe » Wed Dec 09, 2015 2:11 am

thank you for you reply.
but i am lost , do you mean the text file does not have OK values? can I add OK values to the txt file.

is there any other script that I can try ?
mathabathe
Newsterisk
 
Posts: 22
Joined: Thu Apr 03, 2014 12:45 am

Re: Trunkmonitor

Postby ambiorixg12 » Wed Dec 09, 2015 3:09 pm

You can't add the OK manually, it has to be returned by the command to determine that the trunk is UP , for example

asterisk*CLI> dahdi show status
Description Alarms IRQ bpviol CRC4
Wildcard TDM410P Board 1 OK 0 0 0
Wildcard TDM800P Board 2 OK 0 0 0

You can do a similar script easily using bash scripting
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: Trunkmonitor

Postby mathabathe » Mon Jan 04, 2016 8:19 am

I have tried to send the email to jimh@nucleus.com , the guy who wrote the script but it is invalid.
mathabathe
Newsterisk
 
Posts: 22
Joined: Thu Apr 03, 2014 12:45 am


Return to Asterisk General

Who is online

Users browsing this forum: No registered users and 6 guests