User Tools

Site Tools


avaya:sbce:monitoring

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
avaya:sbce:monitoring [2026/04/01 10:15] reto.buergiavaya:sbce:monitoring [2026/04/14 12:12] (current) – [**Testing:**] reto.buergi
Line 11: Line 11:
 **Create Script on SBC Server** **Create Script on SBC Server**
   vi /sbin/check_sbc.sh   vi /sbin/check_sbc.sh
 +<code bash 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" || -z $localnodeip ]]; 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 -e "<prtg>\n<result>"
 +                        echo "<channel>SIP Endpoint Status</channel>"
 +                        echo "<value>UP</value>"
 +                        echo -e "</result>\n</prtg>"
 +                else
 +                        echo -e "<prtg>"
 +                        echo "<error>2</error>"
 +                        echo "<text>`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`</text>"
 +                        echo -e "</prtg>"
 +                fi
 +
 +        else
 +                echo -e "<prtg>\n<result>"
 +                echo "<channel>Is not Primary SBC</channel>"
 +                echo "<value>UP</value>"
 +                echo -e "</result>\n</prtg>"
 +        fi
 +
 +elif [ $1 = "alarmstatus" ]; then
 +        alarms=`psql -d sbcedb -c "select * from alarms;"|tail -n +3|head -n -2`
 +        if [[ -z "$alarms" ]]; then
 +                echo -e "<prtg>\n<result>"
 +                echo "<channel>SBC Alarms</channel>"
 +                echo "<value>OK</value>"
 +                echo -e "</result>\n</prtg>"
 +        else
 +                echo -e "<prtg>"
 +                echo "<error>2</error>"
 +                echo -e "<text>\n"
 +                psql -d sbcedb -c "select trap_severity_level,alarm_notes,alarm_timestampsecs from alarms;"|tail -n +3|head -n -2|sed -re 's/.(.*).*\|.(.*).\|.*([0-9]{10}).*/echo "Serverity: \1 Alarmtext: \2 Date: `date -d @\3`"/e'
 +                echo -e "</text>\n</prtg>"
 +        fi
 +
 +elif [ $1 = "hastatus" ]; then
 +        if [[ $hainfo == "Primary" || $hainfo == "Secondary" ]]; then
 +                echo -e "<prtg>\n<result>"
 +                echo "<channel>HA Status</channel>"
 +                echo "<text>$hainfo</text>"
 +                echo "<value>$hainfo</value>"
 +                echo -e "</result>\n</prtg>"
 +
 +        elif [ -z "$nodeip" ]; then
 +                echo -e "<prtg>\n<result>"
 +                echo "<channel>HA Status</channel>"
 +                echo "<value>NO HA</value>"
 +                echo -e "</result>\n</prtg>"
 +        else
 +                exit 0
 +        fi
 +
 +else
 +        echo "No or wrong command suffix used. Possible options: sipstatus, alarmstatus, hastatus"
 +fi
 +</code>
 +  mkdir -p /var/prtg/scriptsxml
 +  ln -s /sbin/check_sbc.sh /var/prtg/scriptsxml/check_sbc.sh 
 +  chown -R prtg /var/prtg
 +  chown -R prtg.prtg /sbin/check_sbc.sh
 +  chmod 755 /sbin/check_sbc.sh
 +-----------------------------------------------------------\\
 +======Testing======
 +
 +  su - prtg
 +  /var/prtg/scriptsxml/check_sbc.sh alarmstatus
 +  /var/prtg/scriptsxml/check_sbc.sh sipstatus
 +  /var/prtg/scriptsxml/check_sbc.sh hastatus
 +-----------------------------------------------------------
  

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.1775031328.txt.gz · Last modified: by reto.buergi