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?
Best Answer
You certainly already know that
Nagios
needs a number (0,1,2,3) as a return status code from the command launched.if
$?
for thecheck_snmp
command always returns0
, my advice would be to write your own check addingpipe
andgrep
to thecheck_snmp
command, something like :This will return
0 (OK)
if wordGOOD
is found within the output, otherwise it will return1 (Warning)
.