Sign up ×
Server Fault is a question and answer site for 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 -P 2c -C public -o .

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 '14 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 '14 at 19:26
What returns $? just after the check_snmp command in case of a "NOT GOOD" status ? –  krisFR Mar 31 '14 at 19:53
Putting the $? after the check_snmp command simply gives me a No OIDs Specified error. –  DKNUCKLES Mar 31 '14 at 19:54
Even if the SMART status is not good (if you can test this though) ? –  krisFR Mar 31 '14 at 20:19

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 -P 2c -C public -o . | 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

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

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

Your Answer


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.