check_snmp and integer translation

Hi All,

I’m trying to find out how I can translate the integer returned from check_snmp to the actual ASCII message. It’s sort of useless for the message “SNMP OK - 5” to appear in Nagios’ “Status Information” cell if no one knows what the integer “5” means. :wink:

e.g.
[blockquote]check_snmp -H -o .1.3.6.1.4.1.674.10892.1.200.10.1.9.1

SNMP OK - 5[/blockquote]

Any suggestions?
Thanks!

My snmp checks for spanning tree and the rest gives the integer and ascii.

“StgPortState OK - forwarding(5)”

Perhaps you aren’t specifiing the MIB or something. Try a check using every switch that I am using and paste the command line and ouput here for us to see.

checkcommands.cfg
$USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o $ARG2$ -r $ARG3$ -l $ARG4$ -m $ARG5$

services.cfg

check_snmp!Oprivate!.1.3.6.1.4.1.2272.1.13.5.1.4.16.1!5!StgPortState!RAPID-CITY

ouput

StgPortState OK - forwarding(5) | RAPID-CITY::rcStgPortState.16.1=forwarding(5);;;;

As you can see, it says forwarding, and not just “5”

the -l just call it whatever you want like -l powersupplystatus or simply leave it out, but please use all of the rest of switches especially -m.

I notice from your command that you didn’t specify -m, which will make that command look at every MIB installed on the box until it finds the right one to use, which is a waste of time. Tell it EXACTLY which one to use, by using -m MIBname.

Get mbrowse too, if you haven’t already.

jakkedup, thanks for your help! I can now see the error translated, but it only seems to translate when I’m not using -c or -w option.

e.g.

./check_snmp -H -o .1.3.6.1.4.1.674.10892.1.200.10.1.9.1 -C -m ‘/usr/share/snmp/mibs/Dell/10892.mib’ -l ‘Status:’

Status: OK - critical(5)

./check_snmp -H <hostname> -o .1.3.6.1.4.1.674.10892.1.200.10.1.9.1 -C <community> -m '/usr/share/snmp/mibs/Dell/10892.mib' -l 'Status:' -c 6:4

Status: CRITICAL - *5*


Very interesting.  Hopefully it makes since what I'm trying to accomplish.  I'd like Nagios to flag status 4-6 as Critical and I'd like the "Status Information" to give me details as to what 4-6 means.  

I appreciate any further insight you can provide. 
Thanks again! :D

It won’t ever tell you what 4-6 means, it will only tell you what the integer returned means. If the query returns a 5, then the MIB will translate that to critical. try using the -c and -w previous to using the -m switch.

You have Net:SNMP installed right? Perhaps you might recompile the plugin once more.

By “what 4-6 means” I’m refering to the translation which is obtained from the MIB file, which thankfully you pointed me to. :slight_smile:

I tried moving -c and -w before -m but still received the same results. Quite weird. Seems like a small bug to me as -c and -w just changes the flag that Nagios will see in the “Status” column and shouldn’t affect the SNMP integer return variable.

Yes, I do have Net::SNMP installed. That shouldn’t be the issue as I’ve proved previously that it is reading the MIB file.

Just to clarify and make sure we are on the same page, the usual return results of check_snmp are:

[blockquote]SNMP - [/blockquote]
e.g. SNMP OK - 5

If I don’t include -w or -c option it translates the integer.
e.g. SNMP OK - critical(5)

If I include -w or -c option it does NOT translate the integer.
e.g. SNMP CRITICAL - 5
(with -c 6:4 option)

The above example should return with:
SNMP CRITICAL - critical(5)

I’m trying to figure out why it’s not translating the integer with the -w or -c option, when it translates just fine with out those two switches.

Thanks again for your time spent on this!

Edited Mon Aug 01 2005, 03:26PM ]

As I said, recompile the plugin. I have fixed a few problems with plugins by doing so. If you are lik e me, I change stuff on my puter far too often, and perhaps I mess stuff up when I do.