]> granicus.if.org Git - icinga2/commitdiff
Drop CompatUtility::GetCheckable*Interval() and hardcode their minute representation...
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 20 Dec 2017 15:46:50 +0000 (16:46 +0100)
committerMichael Friedrich <michael.friedrich@icinga.com>
Mon, 15 Jan 2018 12:39:34 +0000 (13:39 +0100)
lib/compat/statusdatawriter.cpp
lib/db_ido/hostdbobject.cpp
lib/db_ido/servicedbobject.cpp
lib/icinga/compatutility.cpp
lib/icinga/compatutility.hpp
lib/livestatus/hoststable.cpp
lib/livestatus/servicestable.cpp

index 24be99a682408b8624d9bc13ee9cdb4c0feb4400..768059d5bde399edfdaf723cfb21829fb5cae163 100644 (file)
@@ -264,8 +264,8 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
 
        ObjectLock olock(host);
 
-       fp << "\t" "check_interval" "\t" << CompatUtility::GetCheckableCheckInterval(host) << "\n"
-               "\t" "retry_interval" "\t" << CompatUtility::GetCheckableRetryInterval(host) << "\n"
+       fp << "\t" "check_interval" "\t" << (host->GetCheckInterval() / 60.0) << "\n"
+               "\t" "retry_interval" "\t" << (host->GetRetryInterval() / 60.0) << "\n"
                "\t" "max_check_attempts" "\t" << host->GetMaxCheckAttempts() << "\n"
                "\t" "active_checks_enabled" "\t" << Convert::ToLong(host->GetEnableActiveChecks()) << "\n"
                "\t" "passive_checks_enabled" "\t" << Convert::ToLong(host->GetEnablePassiveChecks()) << "\n"
@@ -338,8 +338,8 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl
 
        fp << "\t" << "check_command=" << CompatUtility::GetCommandName(checkcommand) << "!" << CompatUtility::GetCheckableCommandArgs(checkable) << "\n"
                "\t" "event_handler=" << CompatUtility::GetCommandName(eventcommand) << "\n"
-               "\t" "check_interval=" << CompatUtility::GetCheckableCheckInterval(checkable) << "\n"
-               "\t" "retry_interval=" << CompatUtility::GetCheckableRetryInterval(checkable) << "\n"
+               "\t" "check_interval=" << (checkable->GetCheckInterval() / 60.0) << "\n"
+               "\t" "retry_interval=" << (checkable->GetRetryInterval() / 60.0) << "\n"
                "\t" "has_been_checked=" << Convert::ToLong(checkable->HasBeenChecked()) << "\n"
                "\t" "should_be_scheduled=" << checkable->GetEnableActiveChecks() << "\n"
                "\t" "event_handler_enabled=" << Convert::ToLong(checkable->GetEnableEventHandler()) << "\n";
@@ -432,8 +432,8 @@ void StatusDataWriter::DumpServiceObject(std::ostream& fp, const Service::Ptr& s
                        "\t" "host_name" "\t" << host->GetName() << "\n"
                        "\t" "service_description" "\t" << service->GetShortName() << "\n"
                        "\t" "display_name" "\t" << service->GetDisplayName() << "\n"
-                       "\t" "check_interval" "\t" << CompatUtility::GetCheckableCheckInterval(service) << "\n"
-                       "\t" "retry_interval" "\t" << CompatUtility::GetCheckableRetryInterval(service) << "\n"
+                       "\t" "check_interval" "\t" << (service->GetCheckInterval() / 60.0) << "\n"
+                       "\t" "retry_interval" "\t" << (service->GetRetryInterval() / 60.0) << "\n"
                        "\t" "max_check_attempts" "\t" << service->GetMaxCheckAttempts() << "\n"
                        "\t" "active_checks_enabled" "\t" << Convert::ToLong(service->GetEnableActiveChecks()) << "\n"
                        "\t" "passive_checks_enabled" "\t" << Convert::ToLong(service->GetEnablePassiveChecks()) << "\n"
index c7eb4c89e695d05751f44ec42565f5def3338ade..393bbbb041cf8f8251ca4bacd604fd60800ecfaa 100644 (file)
@@ -68,8 +68,8 @@ Dictionary::Ptr HostDbObject::GetConfigFields() const
        fields->Set("notification_timeperiod_object_id", Empty);
        fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
        fields->Set("failure_prediction_options", Empty);
-       fields->Set("check_interval", CompatUtility::GetCheckableCheckInterval(host));
-       fields->Set("retry_interval", CompatUtility::GetCheckableRetryInterval(host));
+       fields->Set("check_interval", (host->GetCheckInterval() / 60.0));
+       fields->Set("retry_interval", (host->GetRetryInterval() / 60.0));
        fields->Set("max_check_attempts", host->GetMaxCheckAttempts());
 
        fields->Set("first_notification_delay", Empty);
@@ -173,8 +173,8 @@ Dictionary::Ptr HostDbObject::GetStatusFields() const
        fields->Set("failure_prediction_enabled", Empty);
        fields->Set("process_performance_data", host->GetEnablePerfdata());
        fields->Set("obsess_over_host", Empty);
-       fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(host));
-       fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(host));
+       fields->Set("normal_check_interval", (host->GetCheckInterval() / 60.0));
+       fields->Set("retry_check_interval", (host->GetRetryInterval() / 60.0));
        fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
        fields->Set("is_reachable", host->IsReachable());
 
index b39e600dacfc7a6c2fb2b1cc54b067a8240f4140..b50ebe13d7421d4704fabf2660508dea73fe08c7 100644 (file)
@@ -63,8 +63,8 @@ Dictionary::Ptr ServiceDbObject::GetConfigFields() const
        fields->Set("notification_timeperiod_object_id", Empty);
        fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
        fields->Set("failure_prediction_options", Empty);
-       fields->Set("check_interval", CompatUtility::GetCheckableCheckInterval(service));
-       fields->Set("retry_interval", CompatUtility::GetCheckableRetryInterval(service));
+       fields->Set("check_interval", (service->GetCheckInterval() / 60.0));
+       fields->Set("retry_interval", (service->GetRetryInterval() / 60.0));
        fields->Set("max_check_attempts", service->GetMaxCheckAttempts());
        fields->Set("first_notification_delay", Empty);
        fields->Set("notification_interval", CompatUtility::GetCheckableNotificationNotificationInterval(service));
@@ -159,8 +159,8 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields() const
 
        fields->Set("scheduled_downtime_depth", service->GetDowntimeDepth());
        fields->Set("process_performance_data", service->GetEnablePerfdata());
-       fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(service));
-       fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(service));
+       fields->Set("normal_check_interval", (service->GetCheckInterval() / 60.0));
+       fields->Set("retry_check_interval", (service->GetRetryInterval() / 60.0));
        fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
        fields->Set("is_reachable", service->IsReachable());
 
index 4583284bb73b8aede3457932587c893f0c358111..89a0cb95bd2535eea8de6613fff05d2b5e915cb7 100644 (file)
@@ -188,18 +188,6 @@ String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
        return Empty;
 }
 
-/* Used in DB IDO, StatusDataWriter and Livestatus. */
-double CompatUtility::GetCheckableCheckInterval(const Checkable::Ptr& checkable)
-{
-       return checkable->GetCheckInterval() / 60.0;
-}
-
-/* Used in DB IDO, StatusDataWriter and Livestatus. */
-double CompatUtility::GetCheckableRetryInterval(const Checkable::Ptr& checkable)
-{
-       return checkable->GetRetryInterval() / 60.0;
-}
-
 /* Used in Livestatus. */
 int CompatUtility::GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable)
 {
index 6ecf6b81a5251a428ef29dacb17c68d5c1055dff..20ea8c601dc075a88876d26778e14dd41e976750 100644 (file)
@@ -47,8 +47,6 @@ public:
 
        /* service */
        static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
-       static double GetCheckableCheckInterval(const Checkable::Ptr& checkable);
-       static double GetCheckableRetryInterval(const Checkable::Ptr& checkable);
 
        static int GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable);
        static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable);
index b5959b9bc05a3f09bb5d179714624df0828ac941..08e6104e1c55d6ef16dfedc737d71e16815635d0 100644 (file)
@@ -789,7 +789,7 @@ Value HostsTable::CheckIntervalAccessor(const Value& row)
        if (!host)
                return Empty;
 
-       return CompatUtility::GetCheckableCheckInterval(host);
+       return host->GetCheckInterval() / 60.0;
 }
 
 Value HostsTable::RetryIntervalAccessor(const Value& row)
@@ -799,7 +799,7 @@ Value HostsTable::RetryIntervalAccessor(const Value& row)
        if (!host)
                return Empty;
 
-       return CompatUtility::GetCheckableRetryInterval(host);
+       return host->GetRetryInterval() / 60.0;
 }
 
 Value HostsTable::NotificationIntervalAccessor(const Value& row)
index 1e9283bd81b53f3152120bab792907c14533d6a2..c3a941c5e6a777aaedcdf69f92cc6af0d6711e95 100644 (file)
@@ -810,7 +810,7 @@ Value ServicesTable::CheckIntervalAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return CompatUtility::GetCheckableCheckInterval(service);
+       return service->GetCheckInterval() / 60.0;
 }
 
 Value ServicesTable::RetryIntervalAccessor(const Value& row)
@@ -820,7 +820,7 @@ Value ServicesTable::RetryIntervalAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return CompatUtility::GetCheckableRetryInterval(service);
+       return service->GetRetryInterval() / 60.0;
 }
 
 Value ServicesTable::NotificationIntervalAccessor(const Value& row)