Wednesday, 26 December 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:

How to Download and Install RHEL8 Beta For Free (Red Hat Enterprise Linux)

RHEL (Red Hat Enterprise Linux) 8 beta was released on November 14, 2018, 4 years after the release of RHEL 7. This tutorial will be showi...