Page 1 of 1
check_snmp w/multiple valid return values with warning alert
Posted: Tue Jan 22, 2019 3:28 pm
by cloughbe
I need to check a MIB which returns a number from 0-6. A returned value of either 1 or 3 should show OK. Any other return value should result in a down.
I can do this with a RegEx = "1|3" however when it fails it only returns with critical alarm, and I need it to be only a warning alarm.
I have tried many options and can get most values to return as warning, but there is always at least one value that returns as critical
Any help would be appreciated.
Re: check_snmp w/multiple valid return values with warning a
Posted: Thu Jan 24, 2019 11:20 am
by scottwilkerson
The best solution in these cases would be to write a custom plugin that can parse the output and then deliver the results you are looking for.
Here are the Nagios Plugin Development Guidelines
https://nagios-plugins.org/doc/guidelines.html
Re: check_snmp w/multiple valid return values with warning a
Posted: Thu Jan 24, 2019 3:45 pm
by cloughbe
Unfortunately I can't glean enough information from the link provided to create a custom plugin to match my needs.
Re: check_snmp w/multiple valid return values with warning a
Posted: Thu Jan 24, 2019 5:01 pm
by scottwilkerson
here is a different solution.
Create a new command that adds the negate command before the check_snmp command. The command would run something like this:
Code: Select all
/usr/local/nagios/libexec/negate -s -c WARNING /usr/local/nagios/libexec/check_snmp -H 192.168.5.15 -C public -o HOST-RESOURCES-MIB::hrSWRunPerfMem.2204 -r "1|3"
what this will do is change the the state of CRITICAL to WARNING
Re: check_snmp w/multiple valid return values with warning a
Posted: Fri Jan 25, 2019 12:17 pm
by cloughbe
Thank you. That does exactly what I need.

Re: check_snmp w/multiple valid return values with warning a
Posted: Fri Jan 25, 2019 4:51 pm
by cdienger
Glad to hear!