Page 1 of 1

Allow NEB to override host checks

Posted: Sat Mar 15, 2014 9:25 am
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) */

Re: Allow NEB to override host checks

Posted: Mon Mar 17, 2014 10:45 am
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.

Re: Allow NEB to override host checks

Posted: Sat Jul 26, 2014 9:20 am
by jbreams
I created a ticket for this in the tracker: http://tracker.nagios.org/view.php?id=631

Re: Allow NEB to override host checks

Posted: Mon Jul 28, 2014 10:38 am
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.