]> granicus.if.org Git - icinga2/commitdiff
Implement volatile services
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 13 Jun 2013 10:24:20 +0000 (12:24 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 13 Jun 2013 10:24:20 +0000 (12:24 +0200)
Fixes #3593

lib/icinga/service-check.cpp
lib/icinga/service.cpp
lib/icinga/service.h

index 48e8823a180bd766a3edd3d356c52a35dd94e538..4270d8a27d7195cf5ecf16717a659fe6daaa5663 100644 (file)
@@ -402,6 +402,9 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
        if (old_state != GetState() && old_stateType == StateTypeHard && GetStateType() == StateTypeHard)
                hardChange = true;
 
+       if (IsVolatile())
+               hardChange = true;
+
        if (hardChange)
                SetLastHardStateChange(now);
 
index e257eec92a626b95d4edeb9fde8b1440e7bddcf4..4bd5aeda1a2fa2afd293f5d5552c4373cd8c6fc5 100644 (file)
@@ -52,6 +52,7 @@ Service::Service(const Dictionary::Ptr& serializedObject)
        RegisterAttribute("checkers", Attribute_Config, &m_Checkers);
 
        RegisterAttribute("event_command", Attribute_Config, &m_EventCommand);
+       RegisterAttribute("volatile", Attribute_Config, &m_Volatile);
 
        RegisterAttribute("next_check", Attribute_Replicated, &m_NextCheck);
        RegisterAttribute("current_checker", Attribute_Replicated, &m_CurrentChecker);
@@ -223,6 +224,14 @@ bool Service::IsReachable(void) const
        return true;
 }
 
+bool Service::IsVolatile(void) const
+{
+       if (m_Volatile.IsEmpty())
+               return false;
+
+       return m_Volatile;
+}
+
 AcknowledgementType Service::GetAcknowledgement(void)
 {
        ASSERT(OwnsLock());
index d6b0ab02f3f35c68d2b6dc5ec8c0f1f83fedae05..0db3e4dd19c4a41a2c52821a4a03aedfabc9fdf7 100644 (file)
@@ -94,6 +94,8 @@ public:
        std::set<Host::Ptr> GetParentHosts(void) const;
        std::set<Service::Ptr> GetParentServices(void) const;
 
+       bool IsVolatile(void) const;
+
        bool IsReachable(void) const;
 
        AcknowledgementType GetAcknowledgement(void);
@@ -261,6 +263,7 @@ private:
        Attribute<long> m_Acknowledgement;
        Attribute<double> m_AcknowledgementExpiry;
        Attribute<String> m_HostName;
+       Attribute<bool> m_Volatile;
 
        /* Checks */
        Attribute<String> m_CheckCommand;