[icinga-checkins] icinga.org: icinga2/master: Update service state when delegation is unsuccessful

git at icinga.org git at icinga.org
Thu Jan 24 10:40:39 CET 2013


Module: icinga2
Branch: master
Commit: db6c89bc58c30af7dbeb4d50e010c06f11556793
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=db6c89bc58c30af7dbeb4d50e010c06f11556793

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Thu Jan 24 10:40:31 2013 +0100

Update service state when delegation is unsuccessful

Fixes #3548

---

 components/delegation/delegationcomponent.cpp |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/components/delegation/delegationcomponent.cpp b/components/delegation/delegationcomponent.cpp
index 7dff383..d7937ec 100644
--- a/components/delegation/delegationcomponent.cpp
+++ b/components/delegation/delegationcomponent.cpp
@@ -163,7 +163,28 @@ void DelegationComponent::DelegationTimerHandler(void)
 			break;
 		}
 
-		assert(candidates.size() == 0 || !service->GetChecker().IsEmpty());
+		if (candidates.size() == 0) {
+			if (service->GetState() != StateUncheckable && service->GetEnableChecks()) {
+				Dictionary::Ptr cr = boost::make_shared<Dictionary>();
+
+				double now = Utility::GetTime();
+				cr->Set("schedule_start", now);
+				cr->Set("schedule_end", now);
+				cr->Set("execution_start", now);
+				cr->Set("execution_end", now);
+
+				cr->Set("state", StateUncheckable);
+				cr->Set("output", "No checker is available for this service.");
+
+				service->ProcessCheckResult(cr);
+
+				Logger::Write(LogWarning, "delegation", "Can't delegate service: " + service->GetName());
+			}
+
+			continue;
+		}
+
+		assert(!service->GetChecker().IsEmpty());
 	}
 
 	Endpoint::Ptr endpoint;





More information about the icinga-checkins mailing list