double now = Utility::GetTime();
BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjects<Notification>()) {
- if (notification->GetNotificationInterval() <= 0)
- continue;
+ Service::Ptr service = notification->GetService();
- if (notification->GetNextNotification() > now)
+ if (notification->GetNotificationInterval() <= 0 && notification->GetLastProblemNotification() < service->GetLastHardStateChange())
continue;
- Service::Ptr service = notification->GetService();
-
- if (!service)
+ if (notification->GetNextNotification() > now)
continue;
bool reachable = service->IsReachable();
void NotificationComponent::SendNotificationsHandler(const Service::Ptr& service, NotificationType type,
const CheckResult::Ptr& cr, const String& author, const String& text)
{
- service->SendNotifications(static_cast<NotificationType>(type), cr, author, text);
+ service->SendNotifications(type, cr, author, text);
}
{
ObjectLock olock(this);
- SetLastNotification(Utility::GetTime());
+ double now = Utility::GetTime();
+ SetLastNotification(now);
+
+ if (type == NotificationProblem)
+ SetLastProblemNotification(now);
}
std::set<User::Ptr> allUsers;
[state] double last_notification;
[state, set_protected] double next_notification (NextNotificationRaw);
[state, set_protected] Value notification_number;
+ [state] double last_problem_notification;
};
-}
\ No newline at end of file
+}