Page 1 of 1

check_snmp how to read negative numbers

Posted: Tue Jul 14, 2015 8:39 am
by alexprinou
ladies and gentlemen, need to do the check_snmp the nagios return critical and negative numbers .
As follows , Nagios runs the plugin if the return is greater than -70 , for example -71 it alarms critical .
code:
/usr/local/nagios/libexec/check_snmp -H 10.255.255.131 -C public -o .1.3.6.1.4.1.14988.1.1.1.2.1.13.76.94.12.131.149.185.9 -c -78,-79

return :
Range format incorrect

how can I make him read these negative numbers? :mrgreen:

Re: check_snmp how to read negative numbers

Posted: Tue Jul 14, 2015 9:51 am
by jdalrymple
Can you try this patch and see if it helps you? If it does maybe I'll talk to the developers about getting it in and doing a minor revision of plugins package.

http://sourceforge.net/p/nagiosplug/bugs/548/

Re: check_snmp how to read negative numbers

Posted: Mon Oct 26, 2015 3:07 pm
by DiegoAnjos
Hi

I use SNMP Inverter to monitor my UPS: http://mihai.radoveanu.ro/my-plugins/ch ... -inverter/
This plugin is able to trigger Nagios alerts and Service Status if a read number is below the specified.

COMMANDS.cfg:

Code: Select all

define command {
	command_name	check_snmp_inverter
	command_line	$USER1$/check_snmp_inverter.sh -H $HOSTADDRESS$ -C $ARG1$ -o $ARG2$
}
SERVICE DEFINITION on HOSTX.cfg

Code: Select all

define service{
	use			generic-service
	host_name		UPS-XPTO
	service_description	Battery Charge Level
	check_command        	check_snmp_inverter!public!1.3.6.1.2.1.33.1.2.4.0 -w 80 -c 60 -u %
	}
In the service example given, the battery level trigger for warning is 80% and critical is 60%.

Hope that this will be usefull to you.
Warm regards!

Re: check_snmp how to read negative numbers

Posted: Mon Oct 26, 2015 5:17 pm
by tgriep
Thanks DiegoAnjos for the post. Hope it helps.

Re: check_snmp how to read negative numbers

Posted: Wed Jul 05, 2017 3:34 am
by Rile991
Hi all,

I had a similar problem and found some solution. I am running Nagios XI 5.4.4

I wanted to read optical transmit and received power (negative values in dBm), with these tresholds:
warning from -60 to -70
critical from -70 to -00 (negative indefinitely).
I formed my command like this:
$USER1$/check_snmp -H $HOSTADDRESS$ -o $ARG1$ -C public -w -60: -c -70:

This way, Nagios successfully processed negative values.

Also, some potentially useful links:
https://nagios-plugins.org/doc/guidelines.html
https://sourceforge.net/p/nagiosplug/bugs/548/
Hope this will help someone.

Re: check_snmp how to read negative numbers

Posted: Wed Jul 05, 2017 9:52 am
by tmcdonald
Thanks for the info, but this thread is quite old so I will be closing it now.