check_SNMP MIB help


#1

Hi, I’m sure this is a simple solution, i’m just missing somthing.

I just want to monitor the port state on a switch and make it easy for the end user to understand. I can get the port state back as either 1 or 2 (1 up | 2 down) but it just says SNMP OK 1 or SNMP Critical 2. i would like it to say what 1 or 2 means. So i’m trying to use MIBs but this doesn’t change the out come.

The following commands which gives me the correct results but doesn’t seem to pay much attendion to the MIB:

[email protected]:/usr/local/nagios/libexec$ ./check_snmp -H xxx.xxx.xxx.xxx -C public -o .1.3.6.1.2.1.2.2.1.8.4227658 -c 1 -l PortState -m IF-MIB
SNMP CRITICAL - PortState 2 | PortState=2
or
[email protected]:/usr/local/nagios/libexec$ ./check_snmp -H xxx.xxx.xxx.xxx-C public -o ifOperStatus.4227658 -c 1 -l PortState -m IF-MIB
SNMP CRITICAL - PortState 2 | PortState=2

this test was on a 3com 5500G switch but i would prefer a generic soultion so it can be run on many switch with out to much altering.

Any help would be great.

Cheers
Pete


#2

Hi,

I have made some progress. If i use the parameter -v 1 it returns nearly what i’m after on the command line but when adding this to the web i don’t quite get what i’m after.

From the commands line:
./check_snmp -H xxx.xxx.xxx.xxx -C public -o ifOperStatus.4227658 -v 1 -c 1 -l PortState -m IF-MIB
/usr/local/bin/snmpget -t 1 -r 5 -m IF-MIB -v 1 [authpriv] xxx.xxx.xxx.xxx:161 ifOperStatus.4227658
IF-MIB::ifOperStatus.4227658 = INTEGER: down(2)
SNMP CRITICAL - PortState 2 | PortState=2

but on the web frontend on the service page it shows:
/usr/local/bin/snmpget -t 1 -r 5 -m IF-MIB -v 1 [authpriv] xxx.xxx.xxx.xxx ifOperStatus.4227658

and when you click on the service it shows:
/usr/local/bin/snmpget -t 1 -r 5 -m IF-MIB -v 1 [authpriv] xxx.xxx.xxx.xxx:161 ifOperStatus.4227658
IF-MIB::ifOperStatus.4227658 = INTEGER: down(2)
SNMP CRITICAL - PortState 2

I would like it to says something along the lines port state: down (2) if possible

my service is:

define service{
use generic-service ; Inherit values from a template
host_name TCM001
service_description Port 1 Link Status
check_command check_snmp! -C public -o ifOperStatus.4227658 -v 1 -c 1 -l PortState -m IF-MIB
}