Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to configure Icinga to query the SMART status of the hard drives loaded into a storage array I'm configuring.

The issue I've run into is the response from the array when querying the OID of a drive is text, and not a number.

./check_snmp -H 10.0.10.17 -P 2c -C public -o .1.3.6.1.4.1.24681.1.2.11.1.7.1
SNMP OK - "GOOD" |

I'm used to working with numbers rather than strings when dealing with output of check_snmp. Does anyone know how I can create a critical or warning notification when anything other than the output GOOD is returned?

share|improve this question
    
A simple solution would be to just call check_snmp within a script. Have your script get the check_SNMP output, and then perform whatever matching you like on it. But perhaps there is something more elegant. –  Zoredache Mar 31 at 19:25
    
I could certainly do that, however I'm kind of hoping that someone knows of a way to evaluate strings rather than numbers with check_snmp :) –  DKNUCKLES Mar 31 at 19:26
    
What returns $? just after the check_snmp command in case of a "NOT GOOD" status ? –  krisFR Mar 31 at 19:53
    
Putting the $? after the check_snmp command simply gives me a No OIDs Specified error. –  DKNUCKLES Mar 31 at 19:54
    
?? misunderstood. Should return 0 or 1. Run the check_snmp command as you wrote it in your question, once completed run echo $? (all these from a terminal) –  krisFR Mar 31 at 19:57

3 Answers 3

You certainly already know that Nagios needs a number (0,1,2,3) as a return status code from the command launched.

if $? for the check_snmp command always returns 0, my advice would be to write your own check adding pipe and grep to the check_snmp command, something like :

./check_snmp -H 10.0.10.17 -P 2c -C public -o .1.3.6.1.4.1.24681.1.2.11.1.7.1 | grep GOOD

This will return 0 (OK) if word GOOD is found within the output, otherwise it will return 1 (Warning).

share|improve this answer

If you need names instead of numbers (OID) you need to convert those OID into mibs. Download the required mibs for the given purpose (hard drive, interface of a router, services etc...). After you download try using the script with a given name for the purpose. for example if i like to use check_snmp to check the uptime ill do this: ./check_snmp -H iphosts -P 2c -C public -o sysUpTime.0 you can then replace the number OID with the mibs name ... that is all point

share|improve this answer

You cannot use the stock check_snmp with non-numerical values; you have to either write a wrapper around the check_snmp plugin, or use/write a plugin that checks the string values. That's why there are hundreds of SNMP plugin variants for specific hardware. That OID is for a QNAP NAS, right?

Usually, you'll find that someone else has already done the work for you. You can probably use one of these plugins as-is, or fork them:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.