check_snmp with multi OID and conditional?

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
riahc3
Posts: 53
Joined: Thu Apr 05, 2018 9:36 am

check_snmp with multi OID and conditional?

Post by riahc3 »

Im checking a LACP interface where I have NIC1 and NIC2

To make things simple: Lets say 1 is up and 0 is down. Also lets make up the OIDs…

1.2.3.4.5.6.7.8.9.9.9.1 is interface one with it returning a 1 or 0
1.2.3.4.5.6.7.8.9.9.9.2 is interface two with it returning a 1 or 0

Ideally:




./check_snmp -H myfqdn.host.com -o 1.2.3.4.5.6.7.8.9.9.9.1 -o 1.2.3.4.5.6.7.8.9.9.9.2 -P 3 --seclevel=authPriv --secname=user --authproto=SHA --authpasswd='blahblah' --privpasswd='blahblah' --privproto=AES -n

Up till that, everything is understandable.

Here is my thing: I want to return a warning, crit, ok, depending on a conditional: If one interface (either one) is down, it should return a warning. if both are down, it should return a crit and if both are up, it should return a ok. anything else: unknown.

How do I do this?
kyang

Re: check_snmp with multi OID and conditional?

Post by kyang »

I don't see a way to return both a warning or critical in that specific manner. Unless I am mistaken.

There isn't a way to pass unknown as far as I know.

Currently this is how I am testing it. But my values change greater than just 0 to 1.

Code: Select all

[root@localhost libexec]# /usr/local/nagios/libexec/check_snmp -H 192.168.4.12 -P 2c -C 'west' -o ".1.3.6.1.2.1.2.2.1.10.1",".1.3.6.1.2.1.2.2.1.4.1" -w 18000000,70000 -c 20000000,72000
SNMP WARNING - *18885684* 65536 | iso.3.6.1.2.1.2.2.1.10.1=18885684c;18000000;20000000; iso.3.6.1.2.1.2.2.1.4.1=65536;70000;72000;

[root@localhost libexec]# /usr/local/nagios/libexec/check_snmp -H 192.168.4.12 -P 2c -C 'west' -o ".1.3.6.1.2.1.2.2.1.10.1",".1.3.6.1.2.1.2.2.1.4.1" -w 18000000,60000 -c 20000000,72000
SNMP WARNING - *18966219* *65536* | iso.3.6.1.2.1.2.2.1.10.1=18966219c;18000000;20000000; iso.3.6.1.2.1.2.2.1.4.1=65536;60000;72000;

[root@localhost libexec]# /usr/local/nagios/libexec/check_snmp -H 192.168.4.12 -P 2c -C 'west -o ".1.3.6.1.2.1.2.2.1.10.1",".1.3.6.1.2.1.2.2.1.4.1" -w 20000000,50000 -c 21000000,62000
SNMP CRITICAL - 19050370 *65536* | iso.3.6.1.2.1.2.2.1.10.1=19050370c;20000000;21000000; iso.3.6.1.2.1.2.2.1.4.1=65536;50000;62000;
From the help options of check_snmp:

Code: Select all

Notes:
 - Multiple OIDs (and labels) may be indicated by a comma or space-delimited
   list (lists with internal spaces must be quoted).
 - See:
 https://www.nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT
 for THRESHOLD format and examples.
 - When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'
 - Note that only one string and one regex may be checked at present
 - All evaluation methods other than PR, STR, and SUBSTR expect that the value
   returned from the SNMP query is an unsigned integer.
Locked