]> granicus.if.org Git - icinga2/commitdiff
Don't send notifications for services that are unreachable, in a downtime or acknowle...
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 11 Feb 2013 15:38:16 +0000 (16:38 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 11 Feb 2013 15:39:55 +0000 (16:39 +0100)
lib/icinga/service-check.cpp
lib/icinga/service.cpp
lib/icinga/service.h

index 5838bb9ee45c4a06dcd95a8fe74b3889e707e704..a27d567b97545ca3b3a6909489a298e460ee24cd 100644 (file)
@@ -353,7 +353,8 @@ void Service::ApplyCheckResult(const Dictionary::Ptr& cr)
                 * state/state_type attributes. */
                DynamicObject::FlushTx();
 
-               RequestNotifications(NotificationStateChange);
+               if (IsReachable() && !IsInDowntime() && !IsAcknowledged())
+                       RequestNotifications(NotificationStateChange);
        }
 }
 
index bf712f9719dbac5401ec901753bcec0c64b4dccb..26719f0ed205c6ab6e7f15feb231b8741b696cd1 100644 (file)
@@ -190,6 +190,11 @@ void Service::SetAcknowledgement(AcknowledgementType acknowledgement)
        Set("acknowledgement", static_cast<long>(acknowledgement));
 }
 
+bool Service::IsAcknowledged(void)
+{
+       return GetAcknowledgement() != AcknowledgementNone;
+}
+
 double Service::GetAcknowledgementExpiry(void) const
 {
        Value value = Get("acknowledgement_expiry");
index d9f93fe6b255bc7db43baef0431d8e6909059bda..18826477e162ae7869c353ff6982f319986f043c 100644 (file)
@@ -208,6 +208,7 @@ public:
        static void ValidateDowntimeCache(void);
 
        bool IsInDowntime(void) const;
+       bool IsAcknowledged(void);
 
        /* Comments */
        static int GetNextCommentID(void);