Linux and Nagios‎ > ‎

Using check_snmp to check if a metric is within a range or not

posted 18 Feb 2016, 05:21 by Tristan Self
Sometimes a metric needs to fall between a range to be considered OK, and outside the range (i.e. above and below) for a warning, and outside that range (i.e. above and below) for a critical.

So for example monitoring the input voltage into a APC UPS to ensure it is within a certain range.

So lets say OK is between 220 and 240, WARNING would be between 210 and 219; and 241 to 250. With CRITICAL being less than 209 or greater than 251.

So something like:
< 220 and 240 < means OK
> 219 and < 241 means WARNING
> 209 and < 251 means CRITICAL.

To configure the Nagios check use the following, this example pulls out the input voltage from the UPS:

$USER1$/check_snmp -H -o . -C community -w 219:241 -c 209:251

So some examples if the input voltage is: 

230v = OK (within the range of 220 to 240)
218v = WARNING (below the range of 219 for warning)
255v = CRITICAL (above the range of 251 for warning)