Need help with SNMP - everything is OK?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Need help with SNMP - everything is OK?

Post by jsharris »

We are trying to use Nagios to monitor the power status of an Adtran MX2800. We have the MIBs installed and have found the correct OID and have the monitor set up. However, no matter what is indicated in the status information section (normal, warning, failed, etc.) the status is always OK and green. How do I configure Nagios to show a different status dependent on what the SNMP return is?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Need help with SNMP - everything is OK?

Post by ssax »

Is the check returning a string or a numerical value?
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: Need help with SNMP - everything is OK?

Post by jsharris »

This is the result of a test:

COMMAND: /usr/local/nagios/libexec/check_snmp -H spmux -o 1.3.6.1.4.1.664.2.198.1.8.1.3.1 -C public -P 1 -l "Power Supply Status" -m ADTRAN-MX2800-MIB
OUTPUT: SNMP OK - Power Supply Status normal(1) |

It seems that the actual data returned is "normal(1)". Other results include "error(2)", "onBackup(5)", and "powerFail(4)", among others. Our goal is to have anything which is not "normal(1)" to change the status to critical instead of OK
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Need help with SNMP - everything is OK?

Post by ssax »

Add custom command that is as follows:

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_snmp -H spmux -o 1.3.6.1.4.1.664.2.198.1.8.1.3.1 -C public -P 1 -l "Power Supply Status" -m ADTRAN-MX2800-MIB | grep "normal(1)"
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: Need help with SNMP - everything is OK?

Post by jsharris »

A test of that results in :
COMMAND: /usr/local/nagios/libexec/check_snmp -H spmux -o 1.3.6.1.4.1.664.2.198.1.8.1.3.1 -C public -P 1 -l "Power Supply Status" -m ADTRAN-MX2800-MIB |grep "normal(1)"
OUTPUT:
The status changes to warning (yellow) with the status information displayed as:
(No output on stdout) stderr
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Need help with SNMP - everything is OK?

Post by jdalrymple »

Does the following work for you?

Code: Select all

/usr/local/nagios/libexec/check_snmp -H spmux -o 1.3.6.1.4.1.664.2.198.1.8.1.3.1 -C public -P 1 -l "Power Supply Status" -m ADTRAN-MX2800-MIB -r 1 --invert-search
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: Need help with SNMP - everything is OK?

Post by jsharris »

The result from that one is:
COMMAND: /usr/local/nagios/libexec/check_snmp -H spmux -o 1.3.6.1.4.1.664.2.198.1.8.1.3.1 -C public -P 1 -l "Power Supply Status" -m ADTRAN-MX2800-MIB -r 1 --invert-search
OUTPUT: SNMP CRITICAL - Power Supply Status *normal(1)* |
It looks like it changes the status to critical but it appears that it will be critical for all results and not just the non-normal results.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Need help with SNMP - everything is OK?

Post by jdalrymple »

Ooops, my logic was wrong.

Simply omit --invert-search and you should get CRITICAL for any non matching result (a result that doesn't include the integer 1)

See the behavior in my lab:

Code: Select all

[jdalrymple@localhost libexec]$ ./check_snmp -H localhost -C public -o SNMPv2-MIB::sysORUpTime.6 -r 1
SNMP CRITICAL - *Timeticks: (2) 0:00:00.02* |
[jdalrymple@localhost libexec]$ ./check_snmp -H localhost -C public -o SNMPv2-MIB::sysORUpTime.6 -r 2
SNMP OK - Timeticks: (2) 0:00:00.02 |
[jdalrymple@localhost libexec]$ ./check_snmp -H localhost -C public -o SNMPv2-MIB::sysORUpTime.6 -r 2 --invert-search
SNMP CRITICAL - *Timeticks: (2) 0:00:00.02* |
[jdalrymple@localhost libexec]$ ./check_snmp -H localhost -C public -o SNMPv2-MIB::sysORUpTime.6 -r 1 --invert-search
SNMP OK - Timeticks: (2) 0:00:00.02 |
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: Need help with SNMP - everything is OK?

Post by jsharris »

Thank you. I had not seen the full list of available arguments for check_snmp but I looked them up after seeing your suggestion.
I won't be able to try it until lunch time but this looks good. I'll update this afternoon.
jsharris
Posts: 123
Joined: Wed Jul 03, 2013 7:00 am

Re: Need help with SNMP - everything is OK?

Post by jsharris »

That did it! Thank you for your help!
Locked