Changing "No route to host" error code from Crit to Warn

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
KKoovalsky
Posts: 2
Joined: Tue Nov 08, 2016 6:27 am

Changing "No route to host" error code from Crit to Warn

Post 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?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Changing "No route to host" error code from Crit to Warn

Post 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?
Former Nagios Employee
KKoovalsky
Posts: 2
Joined: Tue Nov 08, 2016 6:27 am

Re: Changing "No route to host" error code from Crit to Warn

Post 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.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Changing "No route to host" error code from Crit to Warn

Post 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.
Previous Nagios employee
Locked