1

I am running the check_raid script on a number of machines and I just noticed today that one of my machines was in a degraded state but I was not being alerted. The script is returning "CRITICAL" but Icinga sees it as ok.

Here's what I'm seeing on my Icinga machine (I have replaced the disk):

SNMP OK - "CRITICAL: tw_cli:[c3(9650SE-4LPML): u0(RAID-10): REBUILDING 65%, Cache:Ri, Drives(4): p2=DEGRADED p0,p1,p3=OK]" 

The configuration for this machine is very simple:

define service{
use generic-service
host_name test
service_description RAID Status
check_command check_raid
}

Here's the command definition:

define command{
command_name    check_raid
command_line    /usr/lib/nagios/plugins/check_snmp -H $HOSTADDRESS$ -o ucdavis.80.3.1.1.13.47.117.115.114.47.98.105.110.47.112.101.114.108 -C public -r "OK"

And on the machine being checked I have the following in the snmpd.conf:

extend .1.3.6.1.4.1.2021.80 /usr/bin/perl /usr/local/bin/check_raid.pl

I'm using the latest version of the script, anyone have any ideas about what I'm doing wrong? Is the -r "OK" always returning an ok?

1 Answer 1

1

The nagios script is matching 3 of your 4 return conditions, which is why it returns OK.

From check_snmp documentation:

-r, --ereg=REGEX
   Return OK state (for that OID) if extended regular expression REGEX matches

Your script returns the following (edited by me for brevity):

"CRITICAL: [...] p2=DEGRADED p0,p1,p3=OK]" 

The check_snmp sees p0, p1, p3 are OK and returns OK, ignoring p2

I would try it without the -r "OK" and confirm you get the results you expect. If the incorrect return result persists, I would experiment with --invert-search:

 --invert-search
    Invert search result (CRITICAL if found)
2
  • That was it - I didn't understand what the -r was doing. I have changed my command to: command_line /usr/lib/nagios/plugins/check_snmp -H $HOSTADDRESS$ -o ucdavis.80.3.1.1.13.47.117.115.114.47.98.105.110.47.112.101.114.108 -C public -r "CRITICAL" --invert-search Now it works properly: SNMP CRITICAL - "CRITICAL: tw_cli:[c3(9650SE-4LPML): u0(RAID-10): REBUILDING 94%, Cache:Ri, Drives(4): p2=DEGRADED p0,p1,p3=OK]" Thanks!
    – Bob
    Nov 3, 2016 at 17:52
  • Good to hear! Yes, I was going to edit and suggest -r "DEGRADED" --invert-search (or replace "DEGRADED" with the condition for which you want to receive a critical alert. Glad you found a fix. Nov 3, 2016 at 17:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .