[icinga-checkins] icinga.org: icinga-core/test/core: * core: mark services as executing only when we know we will actually run them ( Andreas Ericsson) #2302

git at icinga.org git at icinga.org
Sun Feb 5 14:03:51 CET 2012


Module: icinga-core
Branch: test/core
Commit: 7204647bdd2b26642562c68f390cfc1b826937fa
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=7204647bdd2b26642562c68f390cfc1b826937fa

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Sun Feb  5 13:48:46 2012 +0100

* core: mark services as executing only when we know we will actually run them (Andreas Ericsson) #2302

currently, the neb callback override happens after
marking the check being executed. if the neb callback
does not take care of resolving this issue itsself,
the service check would never be rescheduled then.

refs #2302

---

 Changelog     |    2 ++
 base/checks.c |   34 +++++++++++++++++-----------------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/Changelog b/Changelog
index 65cc5b4..3907f98 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,8 @@ ENHANCEMENTS
 
 FIXES
 * core: Plug some macro leaks triggered when sending notifications (Andreas Ericsson) #2109
+* core: mark services as executing only when we know we will actually run them (Andreas Ericsson) #2302
+
 * install: Fix notification template installation (Todd Zullinger) #2235
 
 CHANGES
diff --git a/base/checks.c b/base/checks.c
index 7f76c67..8724bcc 100644
--- a/base/checks.c
+++ b/base/checks.c
@@ -601,6 +601,23 @@ int run_async_service_check(service *svc, int check_options, double latency, int
 	/* get the command start time */
 	gettimeofday(&start_time, NULL);
 
+#ifdef USE_EVENT_BROKER
+	/* send data to event broker */
+	neb_result = broker_service_check(NEBTYPE_SERVICECHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, svc, SERVICE_CHECK_ACTIVE, start_time, end_time, svc->service_check_command, svc->latency, 0.0, service_check_timeout, FALSE, 0, processed_command, NULL);
+
+	my_free(svc->processed_command);
+	svc->processed_command = strdup(processed_command);
+
+	/* 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);
+		svc->latency = old_latency;
+		my_free(processed_command);
+		my_free(raw_command);
+		return OK;
+	}
+#endif
+
 	/* increment number of service checks that are currently running... */
 	currently_running_service_checks++;
 
@@ -620,23 +637,6 @@ int run_async_service_check(service *svc, int check_options, double latency, int
 	check_result_info.return_code = STATE_OK;
 	check_result_info.output = NULL;
 
-#ifdef USE_EVENT_BROKER
-	/* send data to event broker */
-	neb_result = broker_service_check(NEBTYPE_SERVICECHECK_INITIATE, NEBFLAG_NONE, NEBATTR_NONE, svc, SERVICE_CHECK_ACTIVE, start_time, end_time, svc->service_check_command, svc->latency, 0.0, service_check_timeout, FALSE, 0, processed_command, NULL);
-
-	my_free(svc->processed_command);
-	svc->processed_command = strdup(processed_command);
-
-	/* 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);
-		svc->latency = old_latency;
-		my_free(processed_command);
-		my_free(raw_command);
-		return OK;
-	}
-#endif
-
 	/* open a temp file for storing check output */
 	old_umask = umask(new_umask);
 	dummy = asprintf(&output_file, "%s/checkXXXXXX", temp_path);





More information about the icinga-checkins mailing list