Skip to content

Commit

Permalink
Fix incorrect notifications for soft recoveries
Browse files Browse the repository at this point in the history
fixes #12529
  • Loading branch information
gunnarbeutner committed Aug 24, 2016
1 parent a14add3 commit deb938d
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/icinga/checkable-check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
if (IsStateOK(cr->GetState())) {
SetStateType(StateTypeHard); // NOT-OK -> HARD OK

if (old_stateType == StateTypeHard && !IsStateOK(old_state))
if (!IsStateOK(old_state))
recovery = true;

ResetNotificationNumbers();
Expand Down Expand Up @@ -278,7 +278,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig

if (notification_reachable && !in_downtime && !IsAcknowledged()) {
/* Send notifications whether when a hard state change occured. */
if (hardChange)
if (hardChange && !(old_stateType == StateTypeSoft && IsStateOK(new_state)))
send_notification = true;
/* Or if the checkable is volatile and in a HARD state. */
else if (is_volatile && GetStateType() == StateTypeHard)
Expand Down Expand Up @@ -383,17 +383,9 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
NotifyFlapping(origin);
}

if (recovery) {
/* Recovery notifications must be sent any time.
* Users who where notified about a problem before
* will be filtered when processing the notification.
*/
if (send_notification && !is_flapping) {
if (!IsPaused())
OnNotificationsRequested(this, NotificationRecovery, cr, "", "", MessageOrigin::Ptr());
} else if (send_notification && !is_flapping) {
/* Problem notifications */
if (!IsPaused())
OnNotificationsRequested(this, NotificationProblem, cr, "", "", MessageOrigin::Ptr());
OnNotificationsRequested(this, recovery ? NotificationRecovery : NotificationProblem, cr, "", "", MessageOrigin::Ptr());
}
}

Expand Down

0 comments on commit deb938d

Please sign in to comment.