From 309c8d7299bf1e5beee41c346a15c10b5ef5de17 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 1 May 2014 22:07:35 +0200 Subject: [PATCH] Fix dependency logging for hosts and services. Fixes #6104 --- lib/icinga/dependency.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/icinga/dependency.cpp b/lib/icinga/dependency.cpp index 679a60564..c38062434 100644 --- a/lib/icinga/dependency.cpp +++ b/lib/icinga/dependency.cpp @@ -65,12 +65,12 @@ void Dependency::OnStateLoaded(void) ASSERT(!OwnsLock()); if (!GetChild()) - Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid child service and will be ignored."); + Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid child object and will be ignored."); else GetChild()->AddDependency(GetSelf()); if (!GetParent()) - Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid parent service and will always fail."); + Log(LogWarning, "icinga", "Dependency '" + GetName() + "' references an invalid parent object and will always fail."); else GetParent()->AddReverseDependency(GetSelf()); } @@ -93,28 +93,28 @@ bool Dependency::IsAvailable(DependencyType dt) const if (!parent) return false; - /* ignore if it's the same service */ + Host::Ptr host; + Service::Ptr service; + tie(host, service) = GetHostService(parent); + + /* ignore if it's the same checkable object */ if (parent == GetChild()) { - Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Parent and child service are identical."); + Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Parent and child " + (service ? "service" : "host") + " are identical."); return true; } - /* ignore pending services */ + /* ignore pending */ if (!parent->GetLastCheckResult()) { - Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Service hasn't been checked yet."); + Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' hasn't been checked yet."); return true; } /* ignore soft states */ if (parent->GetStateType() == StateTypeSoft) { - Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Service is in a soft state."); + Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' is in a soft state."); return true; } - Host::Ptr host; - Service::Ptr service; - tie(host, service) = GetHostService(parent); - int state; if (service) @@ -124,7 +124,7 @@ bool Dependency::IsAvailable(DependencyType dt) const /* check state */ if (state & GetStateFilter()) { - Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: Object matches state filter."); + Log(LogDebug, "icinga", "Dependency '" + GetName() + "' passed: " + (service ? "Service" : "Host") + " '" + parent->GetName() + "' matches state filter."); return true; } -- 2.40.0