Don't send notifications for services that are unreachable, in a downtime or acknowledged.

This commit is contained in:
Gunnar Beutner 2013-02-11 16:38:16 +01:00
parent 18ed997696
commit c6e8013238
3 changed files with 8 additions and 1 deletions

View File

@ -353,6 +353,7 @@ void Service::ApplyCheckResult(const Dictionary::Ptr& cr)
* state/state_type attributes. */ * state/state_type attributes. */
DynamicObject::FlushTx(); DynamicObject::FlushTx();
if (IsReachable() && !IsInDowntime() && !IsAcknowledged())
RequestNotifications(NotificationStateChange); RequestNotifications(NotificationStateChange);
} }
} }

View File

@ -190,6 +190,11 @@ void Service::SetAcknowledgement(AcknowledgementType acknowledgement)
Set("acknowledgement", static_cast<long>(acknowledgement)); Set("acknowledgement", static_cast<long>(acknowledgement));
} }
bool Service::IsAcknowledged(void)
{
return GetAcknowledgement() != AcknowledgementNone;
}
double Service::GetAcknowledgementExpiry(void) const double Service::GetAcknowledgementExpiry(void) const
{ {
Value value = Get("acknowledgement_expiry"); Value value = Get("acknowledgement_expiry");

View File

@ -208,6 +208,7 @@ public:
static void ValidateDowntimeCache(void); static void ValidateDowntimeCache(void);
bool IsInDowntime(void) const; bool IsInDowntime(void) const;
bool IsAcknowledged(void);
/* Comments */ /* Comments */
static int GetNextCommentID(void); static int GetNextCommentID(void);