mirror of https://github.com/Icinga/icinga2.git
Fix notification timer for notifications with interval <= 0.
Fixes #5785
This commit is contained in:
parent
5dbf8f95de
commit
103d95d0df
|
@ -74,13 +74,13 @@ void NotificationComponent::NotificationTimerHandler(void)
|
|||
BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjects<Notification>()) {
|
||||
Checkable::Ptr checkable = notification->GetCheckable();
|
||||
|
||||
if (notification->GetInterval() <= 0 && notification->GetLastProblemNotification() < checkable->GetLastHardStateChange())
|
||||
if (notification->GetInterval() <= 0 && notification->GetLastProblemNotification() > checkable->GetLastHardStateChange())
|
||||
continue;
|
||||
|
||||
if (notification->GetNextNotification() > now)
|
||||
continue;
|
||||
|
||||
bool reachable = checkable->IsReachable();
|
||||
bool reachable = checkable->IsReachable(DependencyNotification);
|
||||
|
||||
{
|
||||
ObjectLock olock(notification);
|
||||
|
@ -88,29 +88,22 @@ void NotificationComponent::NotificationTimerHandler(void)
|
|||
}
|
||||
|
||||
{
|
||||
Host::Ptr host;
|
||||
Service::Ptr service;
|
||||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
ObjectLock olock(checkable);
|
||||
|
||||
if (checkable->GetStateType() == StateTypeSoft)
|
||||
continue;
|
||||
|
||||
Service::Ptr service = dynamic_pointer_cast<Service>(checkable);
|
||||
|
||||
if (service) {
|
||||
if (service->GetState() == ServiceOK)
|
||||
continue;
|
||||
} else {
|
||||
Host::Ptr host = static_pointer_cast<Host>(checkable);
|
||||
|
||||
if (host->GetState() == HostUp)
|
||||
continue;
|
||||
}
|
||||
if ((service && service->GetState() == ServiceOK) || (!service && host->GetState() == HostUp))
|
||||
continue;
|
||||
|
||||
if (!reachable || checkable->IsInDowntime() || checkable->IsAcknowledged())
|
||||
continue;
|
||||
}
|
||||
|
||||
notification->SetLastProblemNotification(now);
|
||||
|
||||
try {
|
||||
Log(LogInformation, "notification", "Sending reminder notification for object '" + checkable->GetName() + "'");
|
||||
notification->BeginExecuteNotification(NotificationProblem, checkable->GetLastCheckResult(), false);
|
||||
|
|
Loading…
Reference in New Issue