From 30236860422af4f49d23ac119f869014483b29fe Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 9 Jul 2013 16:59:31 +0200 Subject: [PATCH] service: add IsHostCheck helper --- lib/icinga/host.cpp | 1 + lib/icinga/service.cpp | 13 +++++++++++++ lib/icinga/service.h | 2 ++ 3 files changed, 16 insertions(+) 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; -- 2.40.0