mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 14:44:32 +02:00
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;
|
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. */
|
/* Used in DB IDO, StatusDataWriter and Livestatus. */
|
||||||
int CompatUtility::GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable)
|
int CompatUtility::GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable)
|
||||||
{
|
{
|
||||||
|
@ -42,8 +42,6 @@ public:
|
|||||||
/* service */
|
/* service */
|
||||||
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
|
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
|
||||||
|
|
||||||
static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable);
|
|
||||||
|
|
||||||
/* notification */
|
/* notification */
|
||||||
static int GetCheckableNotificationsEnabled(const Checkable::Ptr& checkable);
|
static int GetCheckableNotificationsEnabled(const Checkable::Ptr& checkable);
|
||||||
static int GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable);
|
static int GetCheckableNotificationLastNotification(const Checkable::Ptr& checkable);
|
||||||
|
@ -879,7 +879,14 @@ Value HostsTable::InNotificationPeriodAccessor(const Value& row)
|
|||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
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)
|
Value HostsTable::InCheckPeriodAccessor(const Value& row)
|
||||||
|
@ -916,7 +916,14 @@ Value ServicesTable::InNotificationPeriodAccessor(const Value& row)
|
|||||||
if (!service)
|
if (!service)
|
||||||
return Empty;
|
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)
|
Value ServicesTable::ContactsAccessor(const Value& row)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user