]> granicus.if.org Git - icinga2/commitdiff
Drop Freshness wrappers from CompatUtility class
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 6 Dec 2017 14:35:27 +0000 (15:35 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Mon, 15 Jan 2018 12:39:34 +0000 (13:39 +0100)
lib/db_ido/hostdbobject.cpp
lib/db_ido/servicedbobject.cpp
lib/icinga/compatutility.cpp
lib/icinga/compatutility.hpp
lib/livestatus/servicestable.cpp
lib/livestatus/servicestable.hpp

index 0ce0209bee63e29d40a956fc449a332efaa0eabf..0cdfbc5203997809cfcae34546ffed1803a11dfc 100644 (file)
@@ -94,8 +94,8 @@ Dictionary::Ptr HostDbObject::GetConfigFields() const
 
        fields->Set("process_performance_data", host->GetEnablePerfdata());
 
-       fields->Set("freshness_checks_enabled", CompatUtility::GetCheckableFreshnessChecksEnabled(host));
-       fields->Set("freshness_threshold", CompatUtility::GetCheckableFreshnessThreshold(host));
+       fields->Set("freshness_checks_enabled", 1);
+       fields->Set("freshness_threshold", Convert::ToLong(host->GetCheckInterval()));
        fields->Set("event_handler_enabled", host->GetEnableEventHandler());
        fields->Set("passive_checks_enabled", host->GetEnablePassiveChecks());
        fields->Set("active_checks_enabled", host->GetEnableActiveChecks());
index 24a52218906112b34773e98342a8a891af691910..ae9032a008f7b0b2a7726980e305dd4eb6e520db 100644 (file)
@@ -86,8 +86,8 @@ Dictionary::Ptr ServiceDbObject::GetConfigFields() const
        fields->Set("low_flap_threshold", service->GetFlappingThresholdLow());
        fields->Set("high_flap_threshold", service->GetFlappingThresholdLow());
        fields->Set("process_performance_data", service->GetEnablePerfdata());
-       fields->Set("freshness_checks_enabled", CompatUtility::GetCheckableFreshnessChecksEnabled(service));
-       fields->Set("freshness_threshold", CompatUtility::GetCheckableFreshnessThreshold(service));
+       fields->Set("freshness_checks_enabled", 1);
+       fields->Set("freshness_threshold", Convert::ToLong(service->GetCheckInterval()));
        fields->Set("event_handler_enabled", service->GetEnableEventHandler());
        fields->Set("passive_checks_enabled", service->GetEnablePassiveChecks());
        fields->Set("active_checks_enabled", service->GetEnableActiveChecks());
index 7baf65bbd3f6f6bcc1fdf2360174f4711fbb1c15..9a1de411d2719868953170af077c4e29836d3b69 100644 (file)
@@ -202,16 +202,6 @@ String CompatUtility::GetCheckableCheckPeriod(const Checkable::Ptr& checkable)
                return "24x7";
 }
 
-int CompatUtility::GetCheckableFreshnessChecksEnabled(const Checkable::Ptr& checkable)
-{
-       return (checkable->GetCheckInterval() > 0 ? 1 : 0);
-}
-
-int CompatUtility::GetCheckableFreshnessThreshold(const Checkable::Ptr& checkable)
-{
-       return static_cast<int>(checkable->GetCheckInterval());
-}
-
 int CompatUtility::GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable)
 {
        if (CompatUtility::GetCheckableNotificationNotificationInterval(checkable) == 0 && !checkable->GetVolatile())
index 64a6e8cfeb3c2a0aa79bce6ccce84f271aa684aa..0cce3732eacd966be8fab00afd365c3ce14f270d 100644 (file)
@@ -55,9 +55,6 @@ public:
        static double GetCheckableRetryInterval(const Checkable::Ptr& checkable);
        static String GetCheckableCheckPeriod(const Checkable::Ptr& checkable);
 
-       static int GetCheckableFreshnessChecksEnabled(const Checkable::Ptr& checkable);
-       static int GetCheckableFreshnessThreshold(const Checkable::Ptr& checkable);
-       static int GetCheckableIsAcknowledged(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);
index 4bf363a329b1718c9d66e005efee9e818ffbd704..d88c3a90633c06bf023ebbe6b34547f5d90b685c 100644 (file)
@@ -105,7 +105,7 @@ void ServicesTable::AddColumns(Table *table, const String& prefix,
        table->AddColumn(prefix + "active_checks_enabled", Column(&ServicesTable::ActiveChecksEnabledAccessor, objectAccessor));
        table->AddColumn(prefix + "check_options", Column(&Table::EmptyStringAccessor, objectAccessor));
        table->AddColumn(prefix + "flap_detection_enabled", Column(&ServicesTable::FlapDetectionEnabledAccessor, objectAccessor));
-       table->AddColumn(prefix + "check_freshness", Column(&ServicesTable::CheckFreshnessAccessor, objectAccessor));
+       table->AddColumn(prefix + "check_freshness", Column(&Table::OneAccessor, objectAccessor));
        table->AddColumn(prefix + "obsess_over_service", Column(&Table::ZeroAccessor, objectAccessor));
        table->AddColumn(prefix + "modified_attributes", Column(&Table::ZeroAccessor, objectAccessor));
        table->AddColumn(prefix + "modified_attributes_list", Column(&Table::ZeroAccessor, objectAccessor));
@@ -784,16 +784,6 @@ Value ServicesTable::FlapDetectionEnabledAccessor(const Value& row)
        return Convert::ToLong(service->GetEnableFlapping());
 }
 
-Value ServicesTable::CheckFreshnessAccessor(const Value& row)
-{
-       Service::Ptr service = static_cast<Service::Ptr>(row);
-
-       if (!service)
-               return Empty;
-
-       return CompatUtility::GetCheckableFreshnessChecksEnabled(service);
-}
-
 Value ServicesTable::StalenessAccessor(const Value& row)
 {
        Service::Ptr service = static_cast<Service::Ptr>(row);
index afa9c84cde4240e2071979d98459de230b092cb2..17ff49a3a10b7c6b08c381f70ecadd31689abe37 100644 (file)
@@ -99,7 +99,6 @@ protected:
        static Value ProcessPerformanceDataAccessor(const Value& row);
        static Value ActiveChecksEnabledAccessor(const Value& row);
        static Value FlapDetectionEnabledAccessor(const Value& row);
-       static Value CheckFreshnessAccessor(const Value& row);
        static Value StalenessAccessor(const Value& row);
        static Value CheckIntervalAccessor(const Value& row);
        static Value RetryIntervalAccessor(const Value& row);