[icinga-checkins] icinga.org: icinga2/master: Fixed reachability calculation for host checks.
git at icinga.org
git at icinga.org
Wed Feb 27 17:20:32 CET 2013
Module: icinga2
Branch: master
Commit: 39b0806778a13733ec61d01baf40f6056443c83b
URL: https://git.icinga.org/?p=icinga2.git;a=commit;h=39b0806778a13733ec61d01baf40f6056443c83b
Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date: Wed Feb 27 17:20:22 2013 +0100
Fixed reachability calculation for host checks.
---
lib/icinga/service.cpp | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp
index 3ba7d67..f8fdcb0 100644
--- a/lib/icinga/service.cpp
+++ b/lib/icinga/service.cpp
@@ -159,9 +159,20 @@ String Service::GetShortName(void) const
bool Service::IsReachable(const Service::Ptr& self)
{
+ String service_name;
+
+ {
+ ObjectLock olock(self);
+ service_name = self->GetName();
+ }
+
BOOST_FOREACH(const Service::Ptr& service, Service::GetParentServices(self)) {
ObjectLock olock(service);
+ /* ignore ourselves */
+ if (service->GetName() == service_name)
+ continue;
+
/* ignore pending services */
if (!service->GetLastCheckResult())
continue;
@@ -182,6 +193,10 @@ bool Service::IsReachable(const Service::Ptr& self)
Service::Ptr hc = Host::GetHostCheckService(host);
ObjectLock olock(hc);
+ /* ignore ourselves */
+ if (hc->GetName() == service_name)
+ continue;
+
/* ignore hosts that are up */
if (hc && hc->GetState() == StateOK)
continue;
More information about the icinga-checkins
mailing list