36 lines
660 B
Text
36 lines
660 B
Text
|
#!/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
|