I finally figured it out. There wasn’t a check command or plugin available at nagios exchange so I had to modify an existing one.
Interested in trying this…this will save you a ton of time.
./check_snmpwalk.sh check_snmpwalk.sh: Returns number of times a certain value is not matched in an SNMP table column.
Usage: ./check_snmpwalk.sh <hostname> <warn# of conflicts> <crit# of conflicts> "<service id>" <oid> <normal value> <..> <..>
from checkcommands.cfg
command_name check_stp
command_line $USER1$/check_snmpwalk.sh $HOSTADDRESS$ 3 3 "STP" .1.3.6.1.4.1.2272.1.13.5.1.4 3 4 5 6
}
from services.cfg
define service{
use generic-service
host_name host,host,host
service_description check_stp
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
# contact_groups
notification_interval 240
notification_period 24x7
notification_options c,w,r
check_command check_stp
}
check_snmpwalk.sh $HOSTADDRESS$ = check command on host
3 if this value is exceeded, it’s warning, send notification
3 if this value is exceeded, it’s critical, send notification (they are the same because it is either ok, or not).
“STP” is the friendly name, required by the check command
.1.3.6.1.4.1.2272.1.13.5.1.4 is the OID of the table. See rcStgPortState below
3 is a normal value. 3 is for listening.
4 is a normal value. 4 is for learning.
5 is a normal value. 5 is for forwarding
6 is a normal value. 6 is for broken
If the check command finds non normal values, it adds each event. If the number of events exceeds the warning/critical value, it will
send a notification. I left disabled(1) and blocking(2) out as a normal value because I want to know when STP is disabled or a loop has been detected.
from RAPID-CITY.mib but the default snmp.mib file SNMP-MPD-MIB.txt will work just fine.
rcStgPortState OBJECT-TYPE
SYNTAX INTEGER {
disabled(1),
blocking(2),
listening(3),
learning(4),
forwarding(5),
broken(6)
}
ACCESS read-only
STATUS mandatory
DESCRIPTION "The port's current state as defined by
application of the Spanning Tree Protocol. This
state controls what action a port takes on
reception of a frame. If the bridge has detected
a port that is malfunctioning it will place that
port into the broken(6) state. For ports which
are disabled (see rcStgPortEnable), this object
will have a value of disabled(1)."
REFERENCE "IEEE 802.1D-1990: Section 4.5.5.2"
::= { rcStgPortEntry 4 }