From: Gunnar Beutner Date: Mon, 11 Feb 2013 15:38:16 +0000 (+0100) Subject: Don't send notifications for services that are unreachable, in a downtime or acknowle... X-Git-Tag: v0.0.2~445 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6e8013238130c070084b87f8b32fbdd6e2b674c;p=icinga2 Don't send notifications for services that are unreachable, in a downtime or acknowledged. --- diff --git a/lib/icinga/service-check.cpp b/lib/icinga/service-check.cpp index 5838bb9ee..a27d567b9 100644 --- a/lib/icinga/service-check.cpp +++ b/lib/icinga/service-check.cpp @@ -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); } } diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index bf712f971..26719f0ed 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -190,6 +190,11 @@ void Service::SetAcknowledgement(AcknowledgementType acknowledgement) Set("acknowledgement", static_cast(acknowledgement)); } +bool Service::IsAcknowledged(void) +{ + return GetAcknowledgement() != AcknowledgementNone; +} + double Service::GetAcknowledgementExpiry(void) const { Value value = Get("acknowledgement_expiry"); diff --git a/lib/icinga/service.h b/lib/icinga/service.h index d9f93fe6b..18826477e 100644 --- a/lib/icinga/service.h +++ b/lib/icinga/service.h @@ -208,6 +208,7 @@ public: static void ValidateDowntimeCache(void); bool IsInDowntime(void) const; + bool IsAcknowledged(void); /* Comments */ static int GetNextCommentID(void);