Change Status: Green when down! Not red

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
hausrocker
Posts: 16
Joined: Wed Jan 13, 2021 8:48 am

Change Status: Green when down! Not red

Post by hausrocker »

Hi

I have a router with backup WAN connection. The router automatically switches WAN1 up when it detects that WAN2 is not working:

When all is in normal operation WAN1 is down and WAN2 is up.

WAN2 is fine in this case. It is green an does not notify me.

But WAN1 in this scenario is down and red:

Current Status: CRITICAL (for 0d 0h 9m 43s)
Status Information: SNMP CRITICAL - *2*
Performance Data: IF-MIB::ifOperStatus.4=2;;1:1

How can I adjust Nagios that the given "SNMP CRITICAL" status is green?
I would still like to be informed when WAN1 goes up then.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Change Status: Green when down! Not red

Post by gormank »

If you have active checks for each WAN you can use the negate command to change the state from ok to critical.
hausrocker
Posts: 16
Joined: Wed Jan 13, 2021 8:48 am

Re: Change Status: Green when down! Not red

Post by hausrocker »

Thank you for the hint: That worked.

I had to change the commands.cfg and add this:

define command {

command_name check_snmp_disabled
command_line /usr/local/nagios/libexec/negate /usr/local/nagios/libexec/check_snmp -H $HOSTADDRESS$ $ARG1$
}

And switch the check in the switch.cfg like this:

define service{
use generic-service ; Inherit values from a template
host_name Router-Draytek
service_description WAN1 LTE
check_command check_snmp_disabled!-C public -o ifOperStatus.4 -c 1:1
}

And now the status "SNMP CRITICAL - *2* " is green and no notification by email.
Locked