From: Michael Friedrich Date: Tue, 9 Jul 2013 14:59:31 +0000 (+0200) Subject: service: add IsHostCheck helper X-Git-Tag: v0.0.3~876 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30236860422af4f49d23ac119f869014483b29fe;p=icinga2 service: add IsHostCheck helper --- diff --git a/lib/icinga/host.cpp b/lib/icinga/host.cpp index 635b8865d..8ca6738d0 100644 --- a/lib/icinga/host.cpp +++ b/lib/icinga/host.cpp @@ -314,6 +314,7 @@ int Host::GetTotalServices(void) const { return GetServices().size(); } + void Host::InvalidateServicesCache(void) { { diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index f1ca51892..f70e29a36 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -200,6 +200,19 @@ String Service::GetShortName(void) const return m_ShortName; } +bool Service::IsHostCheck(void) const +{ + ASSERT(!OwnsLock()); + + Service::Ptr hc = GetHost()->GetHostCheckService(); + + if (!hc) + return false; + + return (hc->GetName() == GetName()); + +} + bool Service::IsReachable(void) const { ASSERT(!OwnsLock()); diff --git a/lib/icinga/service.h b/lib/icinga/service.h index 4305321ac..153594702 100644 --- a/lib/icinga/service.h +++ b/lib/icinga/service.h @@ -122,6 +122,8 @@ public: std::set GetParentHosts(void) const; std::set GetParentServices(void) const; + bool IsHostCheck(void) const; + bool IsVolatile(void) const; bool IsReachable(void) const;