Page 1 of 1

Need help with SNMP - everything is OK?

Posted: Tue Mar 03, 2015 8:10 am
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?

Re: Need help with SNMP - everything is OK?

Posted: Tue Mar 03, 2015 10:08 am
by ssax
Is the check returning a string or a numerical value?

Re: Need help with SNMP - everything is OK?

Posted: Tue Mar 03, 2015 12:10 pm
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

Re: Need help with SNMP - everything is OK?

Posted: Tue Mar 03, 2015 12:36 pm
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)"

Re: Need help with SNMP - everything is OK?

Posted: Tue Mar 03, 2015 1:07 pm
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

Re: Need help with SNMP - everything is OK?

Posted: Tue Mar 03, 2015 1:21 pm
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

Re: Need help with SNMP - everything is OK?

Posted: Wed Mar 04, 2015 8:36 am
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.

Re: Need help with SNMP - everything is OK?

Posted: Wed Mar 04, 2015 9:56 am
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 |

Re: Need help with SNMP - everything is OK?

Posted: Wed Mar 04, 2015 10:31 am
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.

Re: Need help with SNMP - everything is OK?

Posted: Wed Mar 04, 2015 12:04 pm
by jsharris
That did it! Thank you for your help!