Implement one-time notification for escalation contacts.

Fixes #5011
This commit is contained in:
Gunnar Beutner 2013-11-06 08:36:22 +01:00 committed by Gunnar Beutner
parent 55641fc1ea
commit 92c8d71bf3
3 changed files with 11 additions and 9 deletions

View File

@ -56,17 +56,14 @@ void NotificationComponent::NotificationTimerHandler(void)
double now = Utility::GetTime();
BOOST_FOREACH(const Notification::Ptr& notification, DynamicType::GetObjects<Notification>()) {
if (notification->GetNotificationInterval() <= 0)
Service::Ptr service = notification->GetService();
if (notification->GetNotificationInterval() <= 0 && notification->GetLastProblemNotification() < service->GetLastHardStateChange())
continue;
if (notification->GetNextNotification() > now)
continue;
Service::Ptr service = notification->GetService();
if (!service)
continue;
bool reachable = service->IsReachable();
{
@ -107,5 +104,5 @@ void NotificationComponent::NotificationTimerHandler(void)
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);
}

View File

@ -217,7 +217,11 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
{
ObjectLock olock(this);
SetLastNotification(Utility::GetTime());
double now = Utility::GetTime();
SetLastNotification(now);
if (type == NotificationProblem)
SetLastProblemNotification(now);
}
std::set<User::Ptr> allUsers;

View File

@ -26,6 +26,7 @@ class Notification : DynamicObject
[state] double last_notification;
[state, set_protected] double next_notification (NextNotificationRaw);
[state, set_protected] Value notification_number;
[state] double last_problem_notification;
};
}
}