diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index 10cd4b445..cec4137c1 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -29,8 +29,6 @@ void Host::OnAllConfigLoaded() BOOST_THROW_EXCEPTION(std::invalid_argument("Host '" + GetName() + "' cannot be put into global zone '" + zone->GetName() + "'.")); } - HostGroup::EvaluateObjectRules(this); - Array::Ptr groups = GetGroups(); if (groups) { @@ -49,6 +47,9 @@ void Host::OnAllConfigLoaded() void Host::CreateChildObjects(const Type::Ptr& childType) { + if (childType == HostGroup::TypeInstance) + HostGroup::EvaluateObjectRules(this); + if (childType == ScheduledDowntime::TypeInstance) ScheduledDowntime::EvaluateApplyRules(this); diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index a26512b77..2088f0198 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -56,8 +56,6 @@ void Service::OnAllConfigLoaded() if (m_Host) m_Host->AddService(this); - ServiceGroup::EvaluateObjectRules(this); - Array::Ptr groups = GetGroups(); if (groups) { @@ -76,6 +74,9 @@ void Service::OnAllConfigLoaded() void Service::CreateChildObjects(const Type::Ptr& childType) { + if (childType == ServiceGroup::TypeInstance) + ServiceGroup::EvaluateObjectRules(this); + if (childType == ScheduledDowntime::TypeInstance) ScheduledDowntime::EvaluateApplyRules(this);