cancel
Showing results for 
Search instead for 
Did you mean: 

SNMP Monitor DCA Simple True/Green Red/false

David_Howard
Nimbostratus
Nimbostratus

I want to create a SNMP monitor that is basically just a true/false on the monitor check.

Following the article at

https://support.f5.com/csp/article/K14114

I created a SNMP DCA base

·        i3IcGenSwitchoverRole = 1.3.6.1.4.1.2793.2.1.5.0

·        i3IcGenSwitchoverRole_threshold =2

·        i3IcGenSwitchoverRole_coefficient = 1

 

The threshold is based on the chart below:

Type Access Description

Integer read-only This object displays the switchover role for this CIC server:

1 = NotApplicable because the Server is not in a Primary/Backup configuration.

2 = Primary

3 = Backup

4 = Failed

 

What I really want is for server to be green only if the i3IcGenSwitchoverRole is 2.  I don’t want a calculated value.  A calculated is wrong because the “Backup” is a higher number and is considered by the F5 to be the preferred. If I can do an SNMP true/false on a single value then the application can control its own primary / backup configuration.  Otherwise enabling and disabling of the servers has to be done manually.

1 REPLY 1

David_Howard
Nimbostratus
Nimbostratus

I imported a script and did an external monitor check. I created an external monitor (https://devcentral.f5.com/s/articles/ltm-external-monitors-the-basics) with the variable PREFERRED_STATE=1 and a script. Here is the script:

-----

#!/bin/sh

# remove IPv6/IPv4 compatibility prefix (LTM passes addresses in IPv6 format)

# OID i3IcGenSwitchoverRole = 1.3.6.1.4.1.2793.2.1.5.0

# Preferred States Numbers

#1 = NotApplicable because the Server is not in a Primary/Backup configuration.

#2 = Primary

#3 = Backup

#4 = Failed

 

OID="1.3.6.1.4.1.2793.2.1.5.0"

NODE_IP=`echo ${1} | sed 's/::ffff://'`

NODE_PORT=${2}

 

PIDFILE="/var/run/`basename ${0}`.${IP}_${PORT}.pid"

# kill of the last instance of this monitor if hung and log current pid

if [ -f $PIDFILE ]

then

  echo "exceeded runtime needed to kill ${IP}:${PORT}" | logger -p local0.error

  kill -9 `cat $PIDFILE` > /dev/null 2>&1

fi

 

status=$(snmpwalk -v 2c -c Genesys $NODE_IP $OID| awk '{print $4}')

if [ $status = $PREFERRED_STATE ]; then

 echo $status

fi

rm -f $PIDFILE

exit