+

Last commit for check_sip_latency: 07d7c293ae4b0ab73498b90eed858537e97b19d1

Initial commit

Benjamin Renard [2012-10-09 11:24:55]
Initial commit
#!/bin/bash
# Verifie la latence d'une connexion SIP Asterisk

PEER=$1

[ ! -n "$PEER" ] && echo "Usage : $0 [peer]" && exit 1

CRITICAL=100
WARNING=40

latency=`/usr/bin/sudo -u root /usr/sbin/rasterisk -rnx "sip show peer $PEER"|grep Status|sed 's/.*(\([0-9]*\) ms.*/\1/g'`

if [ ! -n "$latency" ]
then
    /bin/echo "SIP Latency UNKNOWN"
    exit 3
fi

details="Latency : $latency ms"

if [ $latency -gt $CRITICAL ]
then
    nstatus="CRITICAL"
    exitcode=2
elif [ $latency -gt $WARNING ]
then
    nstatus="WARNING"
    exitcode=1
else
    nstatus="OK"
    exitcode=0
fi

/bin/echo "SIP Latency ${nstatus} : $details | latency=${latency}ms"
exit $exitcode
ViewGit