Trunkmonitor

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

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/

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

cd /var/lib/asterisk/agi-bin is empty

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 () {
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

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.

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 ?

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

I have tried to send the email to jimh@nucleus.com , the guy who wrote the script but it is invalid.