Fix dependency logging for hosts and services.

Fixes #6104
This commit is contained in:
Michael Friedrich 2014-05-01 22:07:35 +02:00
parent e295d76483
commit 309c8d7299
1 changed files with 12 additions and 12 deletions

View File

@ -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;
}