mirror of https://github.com/Icinga/icinga2.git
add GetChildHosts() to host object
This commit is contained in:
parent
669e3764bd
commit
f0f3412f2c
|
@ -461,6 +461,29 @@ std::set<Host::Ptr> Host::GetParentHosts(void) const
|
||||||
return parents;
|
return parents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::set<Host::Ptr> Host::GetChildHosts(void) const
|
||||||
|
{
|
||||||
|
std::set<Host::Ptr> childs;
|
||||||
|
|
||||||
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Host")) {
|
||||||
|
const Host::Ptr& host = static_pointer_cast<Host>(object);
|
||||||
|
|
||||||
|
Array::Ptr dependencies = host->GetHostDependencies();
|
||||||
|
|
||||||
|
if (dependencies) {
|
||||||
|
ObjectLock olock(dependencies);
|
||||||
|
|
||||||
|
BOOST_FOREACH(const Value& value, dependencies) {
|
||||||
|
if (value == GetName())
|
||||||
|
childs.insert(host);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return childs;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Service::Ptr Host::GetHostCheckService(void) const
|
Service::Ptr Host::GetHostCheckService(void) const
|
||||||
{
|
{
|
||||||
String host_check = GetHostCheck();
|
String host_check = GetHostCheck();
|
||||||
|
|
|
@ -94,6 +94,7 @@ public:
|
||||||
|
|
||||||
shared_ptr<Service> GetHostCheckService(void) const;
|
shared_ptr<Service> GetHostCheckService(void) const;
|
||||||
std::set<Host::Ptr> GetParentHosts(void) const;
|
std::set<Host::Ptr> GetParentHosts(void) const;
|
||||||
|
std::set<Host::Ptr> GetChildHosts(void) const;
|
||||||
std::set<shared_ptr<Service> > GetParentServices(void) const;
|
std::set<shared_ptr<Service> > GetParentServices(void) const;
|
||||||
|
|
||||||
bool IsReachable() const;
|
bool IsReachable() const;
|
||||||
|
|
Loading…
Reference in New Issue