Add debug log entries for dependencies.

Refs #5872
This commit is contained in:
Michael Friedrich 2014-05-03 21:02:19 +02:00
parent 56bdf820b7
commit ddfccf3188
5 changed files with 41 additions and 12 deletions

View File

@ -696,8 +696,10 @@ void StatusDataWriter::UpdateObjectsCache(void)
BOOST_FOREACH(const Dependency::Ptr& dep, DynamicType::GetObjects<Dependency>()) {
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;

View File

@ -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();

View File

@ -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());

View File

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

View File

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