mirror of https://github.com/Icinga/icinga2.git
livestatus: add current_notification_number to host and service table
refs #4372
This commit is contained in:
parent
b4dd18481b
commit
369fe28acc
|
@ -681,8 +681,21 @@ Value HostsTable::HasBeenCheckedAccessor(const Value& row)
|
|||
|
||||
Value HostsTable::CurrentNotificationNumberAccessor(const Value& row)
|
||||
{
|
||||
/* TODO Host->Service->GetNotifications->(loop) new attribute */
|
||||
return Empty;
|
||||
/* use hostcheck service */
|
||||
Service::Ptr hc = static_cast<Host::Ptr>(row)->GetHostCheckService();
|
||||
|
||||
if (!hc)
|
||||
return Empty;
|
||||
|
||||
/* XXX Service -> Notifications, biggest wins */
|
||||
int notification_number = 0;
|
||||
BOOST_FOREACH(const Notification::Ptr& notification, hc->GetNotifications()) {
|
||||
if (notification->GetNotificationNumber() > notification_number)
|
||||
notification_number = notification->GetNotificationNumber();
|
||||
}
|
||||
|
||||
return notification_number;
|
||||
|
||||
}
|
||||
|
||||
Value HostsTable::PendingFlexDowntimeAccessor(const Value& row)
|
||||
|
|
|
@ -543,8 +543,16 @@ Value ServicesTable::NextNotificationAccessor(const Value& row)
|
|||
|
||||
Value ServicesTable::CurrentNotificationNumberAccessor(const Value& row)
|
||||
{
|
||||
/* TODO not implemented yet */
|
||||
return Empty;
|
||||
Service::Ptr service = static_cast<Service::Ptr>(row);
|
||||
|
||||
/* XXX Service -> Notifications, biggest wins */
|
||||
int notification_number = 0;
|
||||
BOOST_FOREACH(const Notification::Ptr& notification, service->GetNotifications()) {
|
||||
if (notification->GetNotificationNumber() > notification_number)
|
||||
notification_number = notification->GetNotificationNumber();
|
||||
}
|
||||
|
||||
return notification_number;
|
||||
}
|
||||
|
||||
Value ServicesTable::LastStateChangeAccessor(const Value& row)
|
||||
|
|
Loading…
Reference in New Issue