Wednesday, December 26, 2018

sip unreachable alerts

If sip unreachable then send auto mail

vim /home/UNREACHABLE.sh


#!/bin/bash
COUNTER=0
DATE=`date "+%d.%m.%Y. %H:%M"`
Status=`/usr/sbin/asterisk -rx "sip show peers" |grep UNREACHABLE`
SIP=`/usr/sbin/asterisk -rx "sip show peers" |grep UNREACHABLE |wc -l`

if [ $SIP -gt 1 ]
then
echo -e "$Status" | mail -s "SIP Peer Unreachable `hostname` $DATE" example@mail.com
echo $Status
else
   echo "None of the condition met"
fi


Then set in crontab

crontab -e


* * * * * /bin/sh /home/UNREACHABLE.sh


thanks

No comments:

Post a Comment

Installation FreeRADIUS and Daloradius on CentOS 7 and RHEL 7

SELINUX Setting:- Before installations, I recommend turning off SELinux or setting it in permissive mode:- [root@radius ~]# setenforce ...

Popular Posts