check_snmp set range for warning and critical

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
martinkuriax
Posts: 37
Joined: Tue Jul 01, 2014 12:21 pm

check_snmp set range for warning and critical

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_snmp set range for warning and critical

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
martinkuriax
Posts: 37
Joined: Tue Jul 01, 2014 12:21 pm

Re: check_snmp set range for warning and critical

Post by martinkuriax »

Thanks this worked close this post
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_snmp set range for warning and critical

Post by scottwilkerson »

martinkuriax wrote:Thanks this worked close this post
Great! Locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked