mirror of https://github.com/Icinga/icinga2.git
parent
17544d7b54
commit
d909c0945c
|
@ -968,6 +968,7 @@ void ClusterEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& n
|
||||||
params->Set("next_notification", notification->GetNextNotification());
|
params->Set("next_notification", notification->GetNextNotification());
|
||||||
params->Set("notification_number", notification->GetNotificationNumber());
|
params->Set("notification_number", notification->GetNotificationNumber());
|
||||||
params->Set("last_problem_notification", notification->GetLastProblemNotification());
|
params->Set("last_problem_notification", notification->GetLastProblemNotification());
|
||||||
|
params->Set("no_more_notifications", notification->GetNoMoreNotifications());
|
||||||
|
|
||||||
Dictionary::Ptr message = new Dictionary();
|
Dictionary::Ptr message = new Dictionary();
|
||||||
message->Set("jsonrpc", "2.0");
|
message->Set("jsonrpc", "2.0");
|
||||||
|
@ -1051,6 +1052,7 @@ Value ClusterEvents::NotificationSentAllUsersAPIHandler(const MessageOrigin::Ptr
|
||||||
notification->SetNextNotification(params->Get("next_notification"));
|
notification->SetNextNotification(params->Get("next_notification"));
|
||||||
notification->SetNotificationNumber(params->Get("notification_number"));
|
notification->SetNotificationNumber(params->Get("notification_number"));
|
||||||
notification->SetLastProblemNotification(params->Get("last_problem_notification"));
|
notification->SetLastProblemNotification(params->Get("last_problem_notification"));
|
||||||
|
notification->SetNoMoreNotifications(params->Get("no_more_notifications"));
|
||||||
notification->SetNotifiedUsers(Array::FromSet(users));
|
notification->SetNotifiedUsers(Array::FromSet(users));
|
||||||
|
|
||||||
Checkable::OnNotificationSentToAllUsers(notification, checkable, users, type, cr, author, text, origin);
|
Checkable::OnNotificationSentToAllUsers(notification, checkable, users, type, cr, author, text, origin);
|
||||||
|
|
|
@ -364,6 +364,11 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
SetLastNotification(now);
|
SetLastNotification(now);
|
||||||
|
|
||||||
|
if (type == NotificationProblem && GetInterval() <= 0)
|
||||||
|
SetNoMoreNotifications(true);
|
||||||
|
else
|
||||||
|
SetNoMoreNotifications(false);
|
||||||
|
|
||||||
if (type == NotificationProblem && GetInterval() > 0)
|
if (type == NotificationProblem && GetInterval() > 0)
|
||||||
SetNextNotification(now + GetInterval());
|
SetNextNotification(now + GetInterval());
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,10 @@ class Notification : CustomVarObject < NotificationNameComposer
|
||||||
default {{{ return new Array(); }}}
|
default {{{ return new Array(); }}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[state, no_user_modify] bool no_more_notifications {
|
||||||
|
default {{{ return false; }}}
|
||||||
|
};
|
||||||
|
|
||||||
[state] Timestamp last_notification;
|
[state] Timestamp last_notification;
|
||||||
[state] Timestamp next_notification;
|
[state] Timestamp next_notification;
|
||||||
[state] int notification_number;
|
[state] int notification_number;
|
||||||
|
|
|
@ -83,8 +83,11 @@ void NotificationComponent::NotificationTimerHandler(void)
|
||||||
if (!IcingaApplication::GetInstance()->GetEnableNotifications() || !checkable->GetEnableNotifications())
|
if (!IcingaApplication::GetInstance()->GetEnableNotifications() || !checkable->GetEnableNotifications())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (notification->GetInterval() <= 0 && notification->GetLastProblemNotification() > checkable->GetLastHardStateChange())
|
if (notification->GetInterval() <= 0 && notification->GetNoMoreNotifications()) {
|
||||||
|
Log(LogDebug, "NotificationComponent")
|
||||||
|
<< "Skipping reminder notification '" << notification->GetName() << "'. Interval is 0 and no more notifications are required.";
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (notification->GetNextNotification() > now)
|
if (notification->GetNextNotification() > now)
|
||||||
continue;
|
continue;
|
||||||
|
@ -115,7 +118,7 @@ void NotificationComponent::NotificationTimerHandler(void)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log(LogNotice, "NotificationComponent")
|
Log(LogNotice, "NotificationComponent")
|
||||||
<< "Attempting to send reminder notification for object '" << checkable->GetName() << "'";
|
<< "Attempting to send reminder notification '" << notification->GetName() << "'";
|
||||||
notification->BeginExecuteNotification(NotificationProblem, checkable->GetLastCheckResult(), false, true);
|
notification->BeginExecuteNotification(NotificationProblem, checkable->GetLastCheckResult(), false, true);
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
Log(LogWarning, "NotificationComponent")
|
Log(LogWarning, "NotificationComponent")
|
||||||
|
|
Loading…
Reference in New Issue