diff --git a/lib/icinga/checkable.cpp b/lib/icinga/checkable.cpp index f13ea34e4..73bf6afa3 100644 --- a/lib/icinga/checkable.cpp +++ b/lib/icinga/checkable.cpp @@ -153,6 +153,10 @@ void Checkable::NotifyDowntimeInternal(const Downtime::Ptr& downtime) void Checkable::NotifyDowntimeEnd(const Downtime::Ptr& downtime) { + /* don't send notifications for flexible downtimes which never triggered */ + if (!downtime->GetFixed() && !downtime->IsTriggered()) + return; + Checkable::Ptr checkable = downtime->GetCheckable(); if (!checkable->IsPaused()) diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index c903ab5db..a17952672 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -180,7 +180,20 @@ bool Downtime::IsTriggered(void) const bool Downtime::IsExpired(void) const { - return (GetEndTime() < Utility::GetTime()); + double now = Utility::GetTime(); + + if (GetFixed()) + return (GetEndTime() < now); + else { + /* triggered flexible downtime not in effect anymore */ + if (IsTriggered() && !IsInEffect()) + return true; + /* flexible downtime never triggered */ + else if (!IsTriggered() && (GetEndTime() < now)) + return true; + else + return false; + } } int Downtime::GetNextDowntimeID(void)