mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
Fix that notifications with empty times.{begin,end} are not sent
fixes #10363
This commit is contained in:
parent
3f89a6dd09
commit
43a177fb16
@ -282,24 +282,29 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
|
|||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
Dictionary::Ptr times = GetTimes();
|
Dictionary::Ptr times = GetTimes();
|
||||||
|
|
||||||
if (type == NotificationProblem) {
|
if (times && type == NotificationProblem) {
|
||||||
if (times && times->Contains("begin") && now < checkable->GetLastHardStateChange() + times->Get("begin")) {
|
Value timesBegin = times->Get("begin");
|
||||||
|
Value timesEnd = times->Get("end");
|
||||||
|
|
||||||
|
if (timesBegin != Empty && timesBegin >= 0 && now < checkable->GetLastHardStateChange() + timesBegin) {
|
||||||
Log(LogNotice, "Notification")
|
Log(LogNotice, "Notification")
|
||||||
<< "Not sending notifications for notification object '" << GetName() << "': before escalation range";
|
<< "Not sending notifications for notification object '" << GetName()
|
||||||
|
<< "': before specified begin time (" << Utility::FormatDuration(timesBegin) << ")";
|
||||||
|
|
||||||
/* we need to adjust the next notification time
|
/* we need to adjust the next notification time
|
||||||
* to now + begin delaying the first notification
|
* to now + begin delaying the first notification
|
||||||
*/
|
*/
|
||||||
double nextProposedNotification = now + times->Get("begin") + 1.0;
|
double nextProposedNotification = now + timesBegin + 1.0;
|
||||||
if (GetNextNotification() > nextProposedNotification)
|
if (GetNextNotification() > nextProposedNotification)
|
||||||
SetNextNotification(nextProposedNotification);
|
SetNextNotification(nextProposedNotification);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (times && times->Contains("end") && now > checkable->GetLastHardStateChange() + times->Get("end")) {
|
if (timesEnd != Empty && timesEnd >= 0 && now > checkable->GetLastHardStateChange() + timesEnd) {
|
||||||
Log(LogNotice, "Notification")
|
Log(LogNotice, "Notification")
|
||||||
<< "Not sending notifications for notification object '" << GetName() << "': after escalation range";
|
<< "Not sending notifications for notification object '" << GetName()
|
||||||
|
<< "': after specified end time (" << Utility::FormatDuration(timesEnd) << ")";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user