I have come across this problem a number of times.
This is with regards to check_snmp
I am monitoring my APC UPS system using an OID which requires that result should be returned ok if greater than 85%. But nagios gives alerts when the threshold crosses a certain value. In my case if it falls below 85% then it should give an alert. Here is the service.cgi part,
define service{
use generic-nix ; Name of service template to use
This service montiors if the UPS battery is 100%. Now the problem is that when i specify thresholds it will obviously give me warning or down alert as nagios only monitors the thresholds. How can i make nagios montior something like, give an alert when battery status falls below < 85% , warning between 85%<W<90% and green when 100%
Thanks
We have no way of knowing what your command means or if it’s correct. You have to show us the definition of the command from checkcommand.cfg.
And as luca stated, simply use the --help and it tells you how to set thresholds.
From your checkcommand definition and the above check, your:
-w = 98
-c = 100
So what you have defined is, if value returned is above 98 then give a warning and 100 and above, give a critical.
This from ./check_snmp --help “Bare integers are interpreted as upper limits.”
I think what you really want is this.
-w 80:85
-c 0:79
Warning if battery capacity value is from 80-85 and critical if a value from 0-79.
I messed up, this from --help.
"-w, --warning=INTEGER_RANGE(s)
Range(s) which will not result in a WARNING status
-c, --critical=INTEGER_RANGE(s)
Range(s) which will not result in a CRITICAL status"
So it’s
-w 91:100
-c 85:90
You will NOT get a warning if range is between 91-100 and you will NOT get a critical if range is between 85-90. Try that.
Oh, any with check_snmp you should ALWAYS use the -m option or else you pc has to search through all of the mib’s to find what it’s looking for. With the -m option, you TELL IT which one to use and the command runs much quicker.
It looks like the first definition would work if you change the critical range to 85:100 instead of 85:90.
From ./check_snmp -h-
Ranges are inclusive and are indicated with colons. When specified as
’min:max’ a STATE_OK will be returned if the result is within the indicated
range or is equal to the upper or lower bound. A non-OK state will be
returned if the result is outside the specified range.
So with your 85:90 critical range you will get a critical error when the batteries are charged above 90%.