]> granicus.if.org Git - icinga2/commitdiff
service: add IsHostCheck helper
authorMichael Friedrich <michael.friedrich@netways.de>
Tue, 9 Jul 2013 14:59:31 +0000 (16:59 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Tue, 9 Jul 2013 14:59:31 +0000 (16:59 +0200)
lib/icinga/host.cpp
lib/icinga/service.cpp
lib/icinga/service.h

index 635b8865d4d770282f8bef5852ffbb54a4c72667..8ca6738d0a935c8035cd938db4ba21ef845619f7 100644 (file)
@@ -314,6 +314,7 @@ int Host::GetTotalServices(void) const
 {
        return GetServices().size();
 }
+
 void Host::InvalidateServicesCache(void)
 {
        {
index f1ca51892d1104aa57d126478d1514c57c4396fd..f70e29a361d3fe26cdb839fcdde0978b8be79b18 100644 (file)
@@ -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());
index 4305321ace5dc9c3d5dbe7304a62a36c5a42df97..1535947027879552bd40aeee3b530303742fbe30 100644 (file)
@@ -122,6 +122,8 @@ public:
        std::set<Host::Ptr> GetParentHosts(void) const;
        std::set<Service::Ptr> GetParentServices(void) const;
 
+       bool IsHostCheck(void) const;
+
        bool IsVolatile(void) const;
 
        bool IsReachable(void) const;