mirror of https://github.com/Icinga/icinga2.git
parent
b06ea2bef7
commit
5547488cd5
|
@ -173,24 +173,7 @@ static void FireSuppressedNotifications(Checkable* checkable)
|
||||||
bool still_applies = checkable->NotificationReasonApplies(type);
|
bool still_applies = checkable->NotificationReasonApplies(type);
|
||||||
|
|
||||||
if (still_applies) {
|
if (still_applies) {
|
||||||
bool still_suppressed;
|
if (!checkable->NotificationReasonSuppressed(type) && !checkable->IsLikelyToBeCheckedSoon() && !wasLastParentRecoveryRecent.Get()) {
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case NotificationProblem:
|
|
||||||
/* Fall through. */
|
|
||||||
case NotificationRecovery:
|
|
||||||
still_suppressed = !checkable->IsReachable(DependencyNotification) || checkable->IsInDowntime() || checkable->IsAcknowledged();
|
|
||||||
break;
|
|
||||||
case NotificationFlappingStart:
|
|
||||||
/* Fall through. */
|
|
||||||
case NotificationFlappingEnd:
|
|
||||||
still_suppressed = checkable->IsInDowntime();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!still_suppressed && !checkable->IsLikelyToBeCheckedSoon() && !wasLastParentRecoveryRecent.Get()) {
|
|
||||||
Checkable::OnNotificationsRequested(checkable, type, checkable->GetLastCheckResult(), "", "", nullptr);
|
Checkable::OnNotificationsRequested(checkable, type, checkable->GetLastCheckResult(), "", "", nullptr);
|
||||||
|
|
||||||
subtract |= type;
|
subtract |= type;
|
||||||
|
@ -258,6 +241,27 @@ bool Checkable::NotificationReasonApplies(NotificationType type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether *this not allows sending a notification of type type right now.
|
||||||
|
*
|
||||||
|
* @param type The type of notification to send (or not to send).
|
||||||
|
*
|
||||||
|
* @return Whether not to send the notification.
|
||||||
|
*/
|
||||||
|
bool Checkable::NotificationReasonSuppressed(NotificationType type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case NotificationProblem:
|
||||||
|
case NotificationRecovery:
|
||||||
|
return !IsReachable(DependencyNotification) || IsInDowntime() || IsAcknowledged();
|
||||||
|
case NotificationFlappingStart:
|
||||||
|
case NotificationFlappingEnd:
|
||||||
|
return IsInDowntime();
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* E.g. we're going to re-send a stashed problem notification as *this is still not ok.
|
* E.g. we're going to re-send a stashed problem notification as *this is still not ok.
|
||||||
* But if the next check result recovers *this soon, we would send a recovery notification soon after the problem one.
|
* But if the next check result recovers *this soon, we would send a recovery notification soon after the problem one.
|
||||||
|
|
|
@ -175,6 +175,7 @@ public:
|
||||||
void ValidateMaxCheckAttempts(const Lazy<int>& lvalue, const ValidationUtils& value) final;
|
void ValidateMaxCheckAttempts(const Lazy<int>& lvalue, const ValidationUtils& value) final;
|
||||||
|
|
||||||
bool NotificationReasonApplies(NotificationType type);
|
bool NotificationReasonApplies(NotificationType type);
|
||||||
|
bool NotificationReasonSuppressed(NotificationType type);
|
||||||
bool IsLikelyToBeCheckedSoon();
|
bool IsLikelyToBeCheckedSoon();
|
||||||
|
|
||||||
static void IncreasePendingChecks();
|
static void IncreasePendingChecks();
|
||||||
|
|
Loading…
Reference in New Issue