Page 1 of 1

Non-Numeric Value found running check_snmp_generic.pl

Posted: Mon Sep 24, 2018 9:30 am
by smahieu
Hello,

I am trying to setup some monitoring for a Watchguard firewall on Nagios Core using the check_snmp_generic.pl plugin. From the command line, the check runs without issues, e.g.:

./check_snmp_generic.pl -H xx.xx.xx.xx -N "-c COMMUNITY" -l disk -u GB -r -T "3 5 6" -R "\/ (\\d+) (\\d+)" -w 70 -c 85 -D 262144 1.3.6.1.2.1.25.2.3
OK - Current Value: 58.3% | disk=0.7GB;0.84;1.02;0;1.2

However, when run from Nagions, I get status UNKNOWN with a “Non-numeric value found” message.
The check command has been setup as follows:
$USER1$/check_snmp_generic.pl -H $HOSTADDRESS$ -N $ARG1$ -l $ARG2$ -u $ARG3$ -r -T $ARG4$ -R $ARG5$ -w $ARG6$ -c $ARG7$ -D $ARG8$ 1.3.6.1.2.1.25.2.3

As $ARG1$, $ARG4$ and $ARG5$ have spaces in them, I tried single and doublequoting them in the command definition and in the arguments definition, to no avail.

Does the “non numeric value found” message come from the arguments passed to the check or from the output, i.e. "OK – Current Value..."?

I am using NagiosQL 3.4.0 to manage Nagios.

Any tips would be greatly appreciated.

Regards,

Stijn

Re: Non-Numeric Value found running check_snmp_generic.pl

Posted: Tue Sep 25, 2018 11:52 am
by cdienger
Is there more to the "Non-numeric value" message? It looks like it come from this bit of code in the plugin:

Code: Select all

if (!defined($STR_CMPR)) {                                              # this should be a numeric value, "123 123.." for table or "123\n123.." for snmpget
        if (    $VALUES eq "" ||
                $VALUES !~ m/^(\-?[\d]+(\.[\d]+)?\s*)+$/g) {            # only accept numerical values
                $VALUES =~ s/\s+/ /mg;                                  # replace newline with whitespace for displaying
                do_exit "UNKNOWN", "Non-numeric value found: $VALUES";
        }

}
and is caused if $VALUES is blank or contains a non numerical value.

You can edit the command it include the "-v" option to get debug output as well.

Re: Non-Numeric Value found running check_snmp_generic.pl

Posted: Wed Sep 26, 2018 3:20 am
by smahieu
Hello,

The debug output is not really helpful. The command runs fine from the bash prompt. I think Nagios may be unhappy with the output, i.e.
OK - Current Value: 58.3% | disk=0.7GB;0.84;1.02;0;1.2

It says "OK" followed by "Current Value" instead of the value itself. Could it be that Nagios expects a value instead of the words "Current Value" in the output?

Regards,

Stijn Mahieu

Re: Non-Numeric Value found running check_snmp_generic.pl

Posted: Wed Sep 26, 2018 4:32 pm
by cdienger
Try modifying or creating a new check_snmp_generic command under Configure > Core Config Manager > Commands > _Commands, using "$USER1$/check_snmp_generic.pl -H $HOSTADDRESS$ $ARG1$" for the command line field.

The service should then look something like:
generic_snmp.png
with $ARG1$ containing:

-N "-c public -v 2c" -l disk -u GB -r -T "3 5 6" -R "\/ (\\d+) (\\d+)" -w 70 -c 85 -D 262144 1.3.6.1.2.1.25.2.3

It appears that the check will default to snmp v3 and I would get the same error you're seeing if I didn't specify -v 2cin the -N option.

Re: Non-Numeric Value found running check_snmp_generic.pl

Posted: Thu Sep 27, 2018 9:45 am
by smahieu
Hello,

Thanks a lot. That seems to be working now!

Kind Regards,

Stijn Mahieu

Re: Non-Numeric Value found running check_snmp_generic.pl

Posted: Thu Sep 27, 2018 10:01 am
by cdienger
Glad to hear!