mirror of https://github.com/Icinga/icinga2.git
Move CompatUtility::GetCheckableInCheckPeriod() into Livestatus feature
This commit is contained in:
parent
15e3524e42
commit
ce8bfdfa5a
|
@ -210,17 +210,6 @@ int CompatUtility::GetCheckableNoMoreNotifications(const Checkable::Ptr& checkab
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CompatUtility::GetCheckableInCheckPeriod(const Checkable::Ptr& checkable)
|
|
||||||
{
|
|
||||||
TimePeriod::Ptr timeperiod = checkable->GetCheckPeriod();
|
|
||||||
|
|
||||||
/* none set means always checked */
|
|
||||||
if (!timeperiod)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return (timeperiod->IsInside(Utility::GetTime()) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int CompatUtility::GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable)
|
int CompatUtility::GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable)
|
||||||
{
|
{
|
||||||
for (const Notification::Ptr& notification : checkable->GetNotifications()) {
|
for (const Notification::Ptr& notification : checkable->GetNotifications()) {
|
||||||
|
|
|
@ -56,7 +56,6 @@ public:
|
||||||
static String GetCheckableCheckPeriod(const Checkable::Ptr& checkable);
|
static String GetCheckableCheckPeriod(const Checkable::Ptr& checkable);
|
||||||
|
|
||||||
static int GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable);
|
static int GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable);
|
||||||
static int GetCheckableInCheckPeriod(const Checkable::Ptr& checkable);
|
|
||||||
static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable);
|
static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable);
|
||||||
|
|
||||||
/* notification */
|
/* notification */
|
||||||
|
|
|
@ -884,7 +884,13 @@ Value HostsTable::InCheckPeriodAccessor(const Value& row)
|
||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return CompatUtility::GetCheckableInCheckPeriod(host);
|
TimePeriod::Ptr timeperiod = host->GetCheckPeriod();
|
||||||
|
|
||||||
|
/* none set means always checked */
|
||||||
|
if (!timeperiod)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return Convert::ToLong(timeperiod->IsInside(Utility::GetTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::ContactsAccessor(const Value& row)
|
Value HostsTable::ContactsAccessor(const Value& row)
|
||||||
|
|
|
@ -895,7 +895,13 @@ Value ServicesTable::InCheckPeriodAccessor(const Value& row)
|
||||||
if (!service)
|
if (!service)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return CompatUtility::GetCheckableInCheckPeriod(service);
|
TimePeriod::Ptr timeperiod = service->GetCheckPeriod();
|
||||||
|
|
||||||
|
/* none set means always checked */
|
||||||
|
if (!timeperiod)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return Convert::ToLong(timeperiod->IsInside(Utility::GetTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ServicesTable::InNotificationPeriodAccessor(const Value& row)
|
Value ServicesTable::InNotificationPeriodAccessor(const Value& row)
|
||||||
|
|
Loading…
Reference in New Issue