diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index e86f20126..ac87a1529 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -210,17 +210,6 @@ int CompatUtility::GetCheckableNoMoreNotifications(const Checkable::Ptr& checkab 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) { for (const Notification::Ptr& notification : checkable->GetNotifications()) { diff --git a/lib/icinga/compatutility.hpp b/lib/icinga/compatutility.hpp index 4f1c59c60..ee2bf3f2e 100644 --- a/lib/icinga/compatutility.hpp +++ b/lib/icinga/compatutility.hpp @@ -56,7 +56,6 @@ public: static String GetCheckableCheckPeriod(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); /* notification */ diff --git a/lib/livestatus/hoststable.cpp b/lib/livestatus/hoststable.cpp index 17ea108b4..2bc48ea0c 100644 --- a/lib/livestatus/hoststable.cpp +++ b/lib/livestatus/hoststable.cpp @@ -884,7 +884,13 @@ Value HostsTable::InCheckPeriodAccessor(const Value& row) if (!host) 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) diff --git a/lib/livestatus/servicestable.cpp b/lib/livestatus/servicestable.cpp index 1a7d3847d..00b11616c 100644 --- a/lib/livestatus/servicestable.cpp +++ b/lib/livestatus/servicestable.cpp @@ -895,7 +895,13 @@ Value ServicesTable::InCheckPeriodAccessor(const Value& row) if (!service) 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)