check_snmp how to read negative numbers

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
alexprinou
Posts: 23
Joined: Sat Apr 18, 2015 9:06 am

check_snmp how to read negative numbers

Post 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:
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: check_snmp how to read negative numbers

Post 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/
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: check_snmp how to read negative numbers

Post 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!
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_snmp how to read negative numbers

Post by tgriep »

Thanks DiegoAnjos for the post. Hope it helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Rile991
Posts: 1
Joined: Tue Aug 30, 2016 4:10 am

Re: check_snmp how to read negative numbers

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_snmp how to read negative numbers

Post by tmcdonald »

Thanks for the info, but this thread is quite old so I will be closing it now.
Former Nagios employee
Locked