Page 1 of 1

Make switch port status always OK

Posted: Fri Oct 17, 2014 11:33 am
by adam.sage
Is there a way to modify how switch port status is determined? I have quite a few switches that have many ports unplugged I would like to see the status as OK if the interface is up or down. Basically I just want to be able to see if the interface is up or down but not be alerted if it is down. If I can do this through the template that would be even better yet.

Re: Make switch port status always OK

Posted: Fri Oct 17, 2014 11:38 am
by tmcdonald
You would need to write a wrapper script that calls your port monitoring script and passes the output through but keeps the exit code as 0 for OK. This is literally about 3 lines in a bash script:

Code: Select all

#!/bin/sh
/path/to/script -arg val -arg val
exit 0

Re: Make switch port status always OK

Posted: Fri Oct 17, 2014 12:53 pm
by adam.sage
So just run that script once and its done? And if I ever want to go back to the default, what do I change exit 0 to?

Re: Make switch port status always OK

Posted: Fri Oct 17, 2014 1:03 pm
by abrist
You would have to remove the wrapper and go back to the standard check. You could also use the negate plugin:
http://assets.nagios.com/downloads/nagi ... ios-XI.pdf

Re: Make switch port status always OK

Posted: Fri Oct 17, 2014 1:21 pm
by tmcdonald
You would run this new script in lieu of the actual port monitoring script, so in the CCM you would point the service or template to a command that runs this new script. If you want to go back to the old way, you just switch the template back to using the original command.

And bear in mind that the negate plugin will make your OK into CRITICAL and vice-versa. If you just want OK, use the method I have described.

Re: Make switch port status always OK

Posted: Fri Oct 17, 2014 1:44 pm
by adam.sage
Ok, I'll do some testing with it next week. I'm sure I'll have more questions then.

Re: Make switch port status always OK

Posted: Fri Oct 17, 2014 1:49 pm
by abrist
righto, talk to you next week!