====== Check Script for Zabbix ====== #!/bin/sh smconsole="sudo /opt/Avaya/contrib/bin/sm console" if [ $1 = "callcount" ];then callcountSM="${smconsole} GET AllCallCountSM" echo `$callcountSM` | sed -r "s/.*\=A\=([0-9]{1,3}).*/\1/g" elif [ $1 = "health" ];then healthSM1="${smconsole} GET SMHealth 1" healthSM2="${smconsole} GET SMHealth 2" echo `$healthSM1` | sed -r "s/.*name=\"(.*)\".*status=(\w{1,10}),?.*smHealth=(.*)/\1:\2 Health:\3/g" echo `$healthSM2` | sed -r "s/.*name=\"(.*)\".*status=(\w{1,10}),?.*smHealth=(.*)/\1:\2 Health:\3/g" elif [ $1 = "sipentities" ];then sipentities=`${smconsole} MONITOR Summary` #echo ${sipentities} status=`echo ${sipentities} | egrep 'INITIALIZING: \[\w.*\]|PARTIALLYUP: \[\w.*\]|DOWN: \[\w.*\]|DENY: \[\w.*\]'` if [ -z "$status" ];then echo "OK" else echo "Minor" echo ${sipentities} | egrep -o 'INITIALIZING: \[\w.*?\s?\] |PARTIALLYUP: \[\w.*?\s?\] |DOWN: \[\w.*?\s?\] |DENY: \[\w.*?\s?\]' fi elif [ $1 = "registeredp" ];then registeredSM=`${smconsole} GET RegistrationSummary` echo $registeredSM | sed -r "s/.*Primary: ([0-9]{1,5}).*Secondary: ([0-9]{1,5}).*/\1/g" elif [ $1 = "registereds" ];then registeredSM=`${smconsole} GET RegistrationSummary` echo $registeredSM | sed -r "s/.*Primary: ([0-9]{1,5}).*Secondary: ([0-9]{1,5}).*/\2/g" else echo "wrong or missing argument!" fi