mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-01 19:04:39 +02:00
Consult Checkable#state_before_suppression only if there's a suppression
It's only set along with adding NotificationProblem or NotificationRecovery to Checkable#suppressed_notifications and never reset. Also its default, ServiceOK, is an actual state. Not being aware of these facts confuses Checkable#NotificationReasonApplies() which is a condition for cleaning Notification#suppressed_notifications in FireSuppressedNotifications(). I.e. suppressed notifications can get lost.
This commit is contained in:
parent
be50050d2b
commit
cafbe5e670
@ -262,16 +262,20 @@ void Checkable::FireSuppressedNotificationsTimer(const Timer * const&)
|
|||||||
*/
|
*/
|
||||||
bool Checkable::NotificationReasonApplies(NotificationType type)
|
bool Checkable::NotificationReasonApplies(NotificationType type)
|
||||||
{
|
{
|
||||||
|
const auto stateNotifications (NotificationRecovery | NotificationProblem);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NotificationProblem:
|
case NotificationProblem:
|
||||||
{
|
{
|
||||||
auto cr (GetLastCheckResult());
|
auto cr (GetLastCheckResult());
|
||||||
return cr && !IsStateOK(cr->GetState()) && cr->GetState() != GetStateBeforeSuppression();
|
return cr && !IsStateOK(cr->GetState())
|
||||||
|
&& !(cr->GetState() == GetStateBeforeSuppression() && GetSuppressedNotifications() & stateNotifications);
|
||||||
}
|
}
|
||||||
case NotificationRecovery:
|
case NotificationRecovery:
|
||||||
{
|
{
|
||||||
auto cr (GetLastCheckResult());
|
auto cr (GetLastCheckResult());
|
||||||
return cr && IsStateOK(cr->GetState()) && cr->GetState() != GetStateBeforeSuppression();
|
return cr && IsStateOK(cr->GetState())
|
||||||
|
&& !(cr->GetState() == GetStateBeforeSuppression() && GetSuppressedNotifications() & stateNotifications);
|
||||||
}
|
}
|
||||||
case NotificationFlappingStart:
|
case NotificationFlappingStart:
|
||||||
return IsFlapping();
|
return IsFlapping();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user