diff --git a/components/compat/statusdatawriter.cpp b/components/compat/statusdatawriter.cpp index 556e00e45..2b2f0320c 100644 --- a/components/compat/statusdatawriter.cpp +++ b/components/compat/statusdatawriter.cpp @@ -696,8 +696,10 @@ void StatusDataWriter::UpdateObjectsCache(void) BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjects()) { Checkable::Ptr parent = dep->GetParent(); - if (!parent) + if (!parent) { + Log(LogDebug, "compat", "Missing parent for dependency '" + dep->GetName() + "'."); continue; + } Host::Ptr parent_host; Service::Ptr parent_service; @@ -705,8 +707,10 @@ void StatusDataWriter::UpdateObjectsCache(void) Checkable::Ptr child = dep->GetChild(); - if (!child) + if (!child) { continue; + Log(LogDebug, "compat", "Missing child for dependency '" + dep->GetName() + "'."); + } Host::Ptr child_host; Service::Ptr child_service; diff --git a/lib/db_ido/hostdbobject.cpp b/lib/db_ido/hostdbobject.cpp index 356b16af7..9b88bc6b5 100644 --- a/lib/db_ido/hostdbobject.cpp +++ b/lib/db_ido/hostdbobject.cpp @@ -204,8 +204,10 @@ void HostDbObject::OnConfigUpdate(void) BOOST_FOREACH(const Dependency::Ptr& dep, host->GetDependencies()) { Checkable::Ptr parent = dep->GetParent(); - if (!parent) + if (!parent) { + Log(LogDebug, "db_ido", "Missing parent for dependency '" + dep->GetName() + "'."); continue; + } int state_filter = dep->GetStateFilter(); diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp index 109a1aea4..7b3434807 100644 --- a/lib/db_ido/servicedbobject.cpp +++ b/lib/db_ido/servicedbobject.cpp @@ -180,8 +180,10 @@ void ServiceDbObject::OnConfigUpdate(void) BOOST_FOREACH(const Dependency::Ptr& dep, service->GetDependencies()) { Checkable::Ptr parent = dep->GetParent(); - if (!parent) + if (!parent) { + Log(LogDebug, "db_ido", "Missing parent for dependency '" + dep->GetName() + "'."); continue; + } Log(LogDebug, "db_ido", "service parents: " + parent->GetName()); diff --git a/lib/icinga/dependency.cpp b/lib/icinga/dependency.cpp index 4b74fd6f3..485b1cb4c 100644 --- a/lib/icinga/dependency.cpp +++ b/lib/icinga/dependency.cpp @@ -168,10 +168,13 @@ Checkable::Ptr Dependency::GetParent(void) const if (!host) return Service::Ptr(); - if (GetParentServiceName().IsEmpty()) + if (GetParentServiceName().IsEmpty()) { + Log(LogDebug, "icinga", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + "."); return host; - else + } else { + Log(LogDebug, "icinga", "Dependency '" + GetName() + "' parent host '" + GetParentHostName() + "' service '" + GetParentServiceName() + "' ."); return host->GetServiceByShortName(GetParentServiceName()); + } } TimePeriod::Ptr Dependency::GetPeriod(void) const diff --git a/test/config/5872.conf b/test/config/5872.conf index 2dab7c1f4..0405516e3 100644 --- a/test/config/5872.conf +++ b/test/config/5872.conf @@ -30,25 +30,43 @@ object Host "5872-switch" { address = "192.168.1.2", } -apply Dependency "5872-switch" to Host { - child_host_name = "5872-switch" +apply Dependency "5872-host-switch" to Host { parent_host_name = "5872-router" disable_checks = true assign where host.name == "5872-switch" } -apply Dependency "5872-pc" to Host { - child_host_name = "5872-pc" +apply Dependency "5872-host-pc" to Host { parent_host_name = "5872-switch" disable_checks = true assign where host.name == "5872-pc" } -apply Dependency "5872-server" to Host { - child_host_name = "5872-server" +apply Dependency "5872-host-server" to Host { parent_host_name = "5872-switch" disable_checks = true assign where host.name == "5872-server" } +apply Dependency "5872-service-switch" to Service { + parent_host_name = "5872-router" + parent_service_name = "5872-ping4" + disable_checks = true + assign where host.name == "5872-switch" +} + +apply Dependency "5872-service-pc" to Service { + parent_host_name = "5872-switch" + parent_service_name = "5872-ping4" + disable_checks = true + assign where host.name == "5872-pc" +} + +apply Dependency "5872-service-server" to Service { + parent_host_name = "5872-switch" + parent_service_name = "5872-ping4" + states = [ Warning, Critical ] + disable_checks = true + assign where host.name == "5872-server" +}