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 11:12] reto.buergiavaya:sbce:monitoring [2026/04/14 12:12] (current) – [**Testing:**] reto.buergi
Line 16: Line 16:
 hainfo=`psql -d sbcedb -c "SELECT status FROM ha_info WHERE ha_ip = '$(echo $localnodeip)';"|sed -re  '3! d'|sed 's/^.//'` 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 [ $1 = "sipstatus" ]; then
-        if [[ $hainfo == "Primary" ]]; then+        if [[ $hainfo == "Primary" || -z $localnodeip ]]; then
                 #echo "Is Primary"                 #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`                 sipstatus=`psql -d sbcedb -c "select * from sip_server_status_info WHERE NOT hb_status = 'UP';"|tail -n +3|head -n -2`
                 #echo $sipstatus                 #echo $sipstatus
                 if [[ -z "$sipstatus" ]]; then                 if [[ -z "$sipstatus" ]]; then
-                        echo "All SIP Endpoints UP" +                        echo -e "<prtg>\n<result>" 
-                        exit 0+                        echo "<channel>SIP Endpoint Status</channel>" 
 +                        echo "<value>UP</value>
 +                        echo -e "</result>\n</prtg>"
                 else                 else
-                        echo "SIP Status Error:+                        echo -e "<prtg>
-                        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 +                        echo "<error>2</error>" 
-                        exit 2+                        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                 fi
  
         else         else
-                echo "Is not Primary SBC" +                echo -e "<prtg>\n<result>" 
-                exit 0+                echo "<channel>Is not Primary SBC</channel>
 +                echo "<value>UP</value>" 
 +                echo -e "</result>\n</prtg>"
         fi         fi
  
Line 37: Line 42:
         alarms=`psql -d sbcedb -c "select * from alarms;"|tail -n +3|head -n -2`         alarms=`psql -d sbcedb -c "select * from alarms;"|tail -n +3|head -n -2`
         if [[ -z "$alarms" ]]; then         if [[ -z "$alarms" ]]; then
-                echo "no pending Alarms" +                echo -e "<prtg>\n<result>" 
-                exit 0 +                echo "<channel>SBC Alarms</channel>
 +                echo "<value>OK</value>" 
 +                echo -e "</result>\n</prtg>"
         else         else
-                echo "pending Alarms:"+                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'                 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'
-                exit 2+                echo -e "</text>\n</prtg>"
         fi         fi
  
 elif [ $1 = "hastatus" ]; then elif [ $1 = "hastatus" ]; then
         if [[ $hainfo == "Primary" || $hainfo == "Secondary" ]]; then         if [[ $hainfo == "Primary" || $hainfo == "Secondary" ]]; then
-                echo "$hainfo SBC"+                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                 exit 0
-        elif [ -z "$hainfo" ]; then 
-                echo "Single SBC" 
-                exit 0 
-        else 
-                echo "HA-Status: SBC $hainfo" 
-                exit 2 
         fi         fi
  
Line 62: Line 75:
 fi fi
 </code> </code>
-  mkdir -p /var/prtg/scripts +  mkdir -p /var/prtg/scriptsxml 
-  ln -s /sbin/check_sbc.sh /var/prtg/scripts/check_sbc.sh +  ln -s /sbin/check_sbc.sh /var/prtg/scriptsxml/check_sbc.sh 
   chown -R prtg /var/prtg   chown -R prtg /var/prtg
   chown -R prtg.prtg /sbin/check_sbc.sh   chown -R prtg.prtg /sbin/check_sbc.sh
   chmod 755 /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.1775034769.txt.gz · Last modified: by reto.buergi