Page 1 of 1
Changing "No route to host" error code from Crit to Warn
Posted: Tue Nov 08, 2016 6:34 am
by KKoovalsky
Hi!
How can I change error codes of "No route to host" and "Connection refused or timed out" notifications from critical to warning?
Re: Changing "No route to host" error code from Crit to Warn
Posted: Tue Nov 08, 2016 10:32 am
by rkennedy
Usually, you'll need to write a wrapper script to sit in front of the plugin to handle the logic for if it detects that text.
It might be built in with the plugin, though - which plugin are you using?
Re: Changing "No route to host" error code from Crit to Warn
Posted: Wed Nov 09, 2016 4:31 am
by KKoovalsky
I'm using check_ping. Inside check_ping.cfg I have service check_host_alive with this plugin used with -c arg not optional. I tried to call check_ping with -c 101%, but this doesn't work.
Re: Changing "No route to host" error code from Crit to Warn
Posted: Wed Nov 09, 2016 2:35 pm
by avandemore
Developing custom plugins is really out of scope for support but we can tell you how it works.
Your wrapping plugin needs to sit as a shim between the standard check_ping and Nagios. The custom plugin will execute check_ping and process the data. If it gets text like No route to host or Connection refused or timed out then the custom plugin needs to exit with a return code of 1 instead of 2 as the standard plugin would do.