Page 1 of 1

check_snmp set range for warning and critical

Posted: Tue Jun 26, 2018 9:11 am
by martinkuriax
Hi,

I am trying to set alerts for temperature

Normal operating range should be [21°C – 25°C]

19°C => is Low Temperature and
27°C => is High Temperature

I would like to get alerts on:
- critical alert if the temperature is below 19°C,
- critical alert if the temperature is above 27°C
- warning alert if the temperature is between 19°C to 21°C and
- warning alert if the temperature is between 25°C and 27°C

How do I achieve this, I have tried with the command below is it correct way?

/usr/local/nagios/libexec/check_snmp -H 1x.x.1x.x -o .1.3.6.1.4.1.9839.2.1.2.1.0 -w 26:21 -c 27 -C xxx

Re: check_snmp set range for warning and critical

Posted: Tue Jun 26, 2018 9:17 am
by scottwilkerson
martinkuriax wrote:I would like to get alerts on:
- critical alert if the temperature is below 19°C,
- critical alert if the temperature is above 27°C
- warning alert if the temperature is between 19°C to 21°C and
- warning alert if the temperature is between 25°C and 27°C
From the manpage:

Code: Select all

     -w, --warning=THRESHOLD(s)
        Warning threshold range(s)
     -c, --critical=THRESHOLD(s)
        Critical threshold range(s)
...
- When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'
Here's how the Nagios Plugin Development Guidelines says you should handle ranges in your plugins:
https://nagios-plugins.org/doc/guidelin ... HOLDFORMAT

So, I propose this:

Code: Select all

/usr/local/nagios/libexec/check_snmp -H 1x.x.1x.x -o .1.3.6.1.4.1.9839.2.1.2.1.0 -w @19:21,@25-27 -c 19:27 -C xxx

Re: check_snmp set range for warning and critical

Posted: Thu Jun 28, 2018 3:08 am
by martinkuriax
Thanks this worked close this post

Re: check_snmp set range for warning and critical

Posted: Thu Jun 28, 2018 7:07 am
by scottwilkerson
martinkuriax wrote:Thanks this worked close this post
Great! Locking