Allow NEB to override host checks

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
jbreams
Posts: 2
Joined: Sun Dec 08, 2013 7:01 pm

Allow NEB to override host checks

Post by jbreams »

Nagios lets event brokers override service checks, but not host checks. This proposed patch adds that functionality.

Code: Select all

--- checks.c.orig	2014-03-15 10:12:57.000000000 -0400
+++ checks.c	2014-03-15 10:16:01.000000000 -0400
@@ -2085,7 +2085,16 @@
 
 #ifdef USE_EVENT_BROKER
 	/* send data to event broker */
-	broker_host_check(NEBTYPE_HOSTCHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, hst, CHECK_TYPE_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, processed_command, NULL, NULL, NULL, NULL, cr);
+	neb_result = broker_host_check(NEBTYPE_HOSTCHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, hst, CHECK_TYPE_ACTIVE, hst->current_state, hst->state_type, start_time, end_time, hst->check_command, hst->latency, 0.0, host_check_timeout, FALSE, 0, processed_command, NULL, NULL, NULL, NULL, cr);
+
+	/* neb module wants to override the service check - perhaps it will check the service itself */
+	if(neb_result == NEBERROR_CALLBACKOVERRIDE) {
+		clear_volatile_macros_r(&mac);
+		hst->latency = old_latency;
+		free_check_result(cr);
+		my_free(processed_command);
+		return OK;
+		}
 #endif
 
 	/* reset latency (permanent value for this check will get set later) */
Last edited by jbreams on Thu Jul 31, 2014 10:48 pm, edited 1 time in total.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Allow NEB to override host checks

Post by sreinhardt »

Could you please post this on tracker.nagios.org if you have not already. I only ask that you do, so that you may be notified as the suggestion is processed. Additionally, if you post a link back here to the tracker bug, I will be happy to create an internal bug and link them as well.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
jbreams
Posts: 2
Joined: Sun Dec 08, 2013 7:01 pm

Re: Allow NEB to override host checks

Post by jbreams »

I created a ticket for this in the tracker: http://tracker.nagios.org/view.php?id=631
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Allow NEB to override host checks

Post by sreinhardt »

Created an internal feature request and tied the two. If I get a chance I'll make a pull request on github for you as well.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked