check_snmp w/multiple valid return values with warning alert

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
cloughbe
Posts: 3
Joined: Tue Jan 22, 2019 3:18 pm

check_snmp w/multiple valid return values with warning alert

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

Re: check_snmp w/multiple valid return values with warning a

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
cloughbe
Posts: 3
Joined: Tue Jan 22, 2019 3:18 pm

Re: check_snmp w/multiple valid return values with warning a

Post by cloughbe »

Unfortunately I can't glean enough information from the link provided to create a custom plugin to match my needs.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_snmp w/multiple valid return values with warning a

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
cloughbe
Posts: 3
Joined: Tue Jan 22, 2019 3:18 pm

Re: check_snmp w/multiple valid return values with warning a

Post by cloughbe »

Thank you. That does exactly what I need. :D
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: check_snmp w/multiple valid return values with warning a

Post by cdienger »

Glad to hear!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked