User Tools

Site Tools


avaya:sbce:monitoring

This is an old revision of the document!


PRTG Monitoring Script

Add Service Account

useradd -m prtg
passwd prtg

GRANT SQL Access to prtg User

psql -U postgres -d sbcedb
CREATE USER prtg WITH PASSWORD 'xxxxxxxxxxxxxxxx';
GRANT SELECT ON ALL TABLES IN SCHEMA public TO prtg;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO prtg;
GRANT CONNECT ON DATABASE sbcedb to prtg;

Create Script on SBC Server

vi /sbin/check_sbc.sh
check_sbc.sh
#!/bin/bash
localnodeip=`ifconfig M2 |grep "inet "|sed -re 's/inet ([1].*)  netmask.*/\1/g'`
hainfo=`psql -d sbcedb -c "SELECT status FROM ha_info WHERE ha_ip = '$(echo $localnodeip)';"|sed -re  '3! d'|sed 's/^.//'`
if [ $1 = "sipstatus" ];then
        if [[ $hainfo == "Primary" ]]; then
                #echo "Is Primary"
                sipstatus=`psql -d sbcedb -c "select * from sip_server_status_info WHERE NOT hb_status = 'UP';"|tail -n +3|head -n -2`
                #echo $sipstatus
                if [[ -z "$sipstatus" ]]; then
                        echo "All SIP Endpoints UP"
                        exit 0
                else
                        echo "SIP Status Error:"
                        psql -d sbcedb -c "select ip_address,transport_type, port,hb_status from sip_server_status_info WHERE NOT hb_status = 'UP';"|tail -n +3|head -n -2
                        exit 2
                fi
 
        else
                echo "Is not Primary SBC"
                exit 0
        fi
 
elif [ $1 = "alarmstatus" ];then
        alarms=`psql -d sbcedb -c "select * from alarms;"|tail -n +3|head -n -2`
        if [[ -z "$alarms" ]];then
                echo "no pending Alarms"
                exit 0
        else
                echo "pending Alarms:"
                psql -d sbcedb -c "select * from alarms;"|tail -n +3|head -n -2
                exit 2
        fi
 
elif [ $1 = "hastatus" ];then
        if [[ $hainfo == "Primary" || $hainfo == "Secondary" ]]
                echo $hainfo SBC
                exit 0
        elif [[ -z "$hainfo" ]]
                echo "Single SBC"
                exit 0
        else
                echo "HA-Status: SBC $hainfo"
                exit 2
 
else
        echo "No or wrong command suffix used. Possible options: sipstatus, alarmstatus, hastatus"
fi
mkdir -p /var/prtg/scripts
ln -s /sbin/check_sbc.sh /var/prtg/scripts/check_sbc.sh 
chown -R prtg /var/prtg
chown prtg.prtg /sbin/check_sbc.sh
chmod 755 /sbin/check_sbc.sh

This topic does not exist yet

You've followed a link to a topic that doesn't exist yet. If permissions allow, you may create it by clicking on Create this page.

avaya/sbce/monitoring.1775031992.txt.gz · Last modified: by reto.buergi