Non-Numeric Value found running check_snmp_generic.pl

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
smahieu
Posts: 3
Joined: Fri Jun 01, 2018 7:51 am

Non-Numeric Value found running check_snmp_generic.pl

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Non-Numeric Value found running check_snmp_generic.pl

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
smahieu
Posts: 3
Joined: Fri Jun 01, 2018 7:51 am

Re: Non-Numeric Value found running check_snmp_generic.pl

Post 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
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Non-Numeric Value found running check_snmp_generic.pl

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
smahieu
Posts: 3
Joined: Fri Jun 01, 2018 7:51 am

Re: Non-Numeric Value found running check_snmp_generic.pl

Post by smahieu »

Hello,

Thanks a lot. That seems to be working now!

Kind Regards,

Stijn Mahieu
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Non-Numeric Value found running check_snmp_generic.pl

Post by cdienger »

Glad to hear!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked