mirror of https://github.com/Icinga/icinga2.git
Move CompatUtility::GetCheckableInNotificationPeriod() logic into Livestatus feature
This commit is contained in:
parent
7a012c062a
commit
9de233630a
|
@ -147,19 +147,6 @@ String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
|
|||
return Empty;
|
||||
}
|
||||
|
||||
/* Used in Livestatus. */
|
||||
int CompatUtility::GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable)
|
||||
{
|
||||
for (const Notification::Ptr& notification : checkable->GetNotifications()) {
|
||||
TimePeriod::Ptr timeperiod = notification->GetPeriod();
|
||||
|
||||
if (!timeperiod || timeperiod->IsInside(Utility::GetTime()))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Used in DB IDO, StatusDataWriter and Livestatus. */
|
||||
int CompatUtility::GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable)
|
||||
{
|
||||
|
|
|
@ -42,8 +42,6 @@ public:
|
|||
/* service */
|
||||
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
|
||||
|
||||
static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable);
|
||||
|
||||
/* notification */
|
||||
static int GetCheckableNotificationsEnabled(const Checkable::Ptr& checkable);
|
||||
static int GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable);
|
||||
|
|
|
@ -879,7 +879,14 @@ Value HostsTable::InNotificationPeriodAccessor(const Value& row)
|
|||
if (!host)
|
||||
return Empty;
|
||||
|
||||
return CompatUtility::GetCheckableInNotificationPeriod(host);
|
||||
for (const Notification::Ptr& notification : host->GetNotifications()) {
|
||||
TimePeriod::Ptr timeperiod = notification->GetPeriod();
|
||||
|
||||
if (!timeperiod || timeperiod->IsInside(Utility::GetTime()))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Value HostsTable::InCheckPeriodAccessor(const Value& row)
|
||||
|
|
|
@ -916,7 +916,14 @@ Value ServicesTable::InNotificationPeriodAccessor(const Value& row)
|
|||
if (!service)
|
||||
return Empty;
|
||||
|
||||
return CompatUtility::GetCheckableInNotificationPeriod(service);
|
||||
for (const Notification::Ptr& notification : service->GetNotifications()) {
|
||||
TimePeriod::Ptr timeperiod = notification->GetPeriod();
|
||||
|
||||
if (!timeperiod || timeperiod->IsInside(Utility::GetTime()))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Value ServicesTable::ContactsAccessor(const Value& row)
|
||||
|
|
Loading…
Reference in New Issue