]> granicus.if.org Git - icinga2/commitdiff
Explicitly write the 1.x legacy attribute 'interval_length' for Livestatus 7404/head
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 7 Aug 2019 13:22:09 +0000 (15:22 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 7 Aug 2019 13:23:04 +0000 (15:23 +0200)
fixes #7402

lib/livestatus/hoststable.cpp
lib/livestatus/servicestable.cpp
lib/livestatus/statustable.cpp
lib/livestatus/statustable.hpp
lib/livestatus/table.hpp

index 645c4387bfba3dbd672440760a50ce4031c31423..9ecc45a40e415daaa57006d41dd3fd1209876773 100644 (file)
@@ -771,7 +771,7 @@ Value HostsTable::CheckIntervalAccessor(const Value& row)
        if (!host)
                return Empty;
 
-       return host->GetCheckInterval() / 60.0;
+       return host->GetCheckInterval() / LIVESTATUS_INTERVAL_LENGTH;
 }
 
 Value HostsTable::RetryIntervalAccessor(const Value& row)
@@ -781,7 +781,7 @@ Value HostsTable::RetryIntervalAccessor(const Value& row)
        if (!host)
                return Empty;
 
-       return host->GetRetryInterval() / 60.0;
+       return host->GetRetryInterval() / LIVESTATUS_INTERVAL_LENGTH;
 }
 
 Value HostsTable::NotificationIntervalAccessor(const Value& row)
index 98d27f84b11f75310b9fd5522a8243d2db10201c..e8906f71a90ca78137184907e50ab6938d11eb09 100644 (file)
@@ -792,7 +792,7 @@ Value ServicesTable::CheckIntervalAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return service->GetCheckInterval() / 60.0;
+       return service->GetCheckInterval() / LIVESTATUS_INTERVAL_LENGTH;
 }
 
 Value ServicesTable::RetryIntervalAccessor(const Value& row)
@@ -802,7 +802,7 @@ Value ServicesTable::RetryIntervalAccessor(const Value& row)
        if (!service)
                return Empty;
 
-       return service->GetRetryInterval() / 60.0;
+       return service->GetRetryInterval() / LIVESTATUS_INTERVAL_LENGTH;
 }
 
 Value ServicesTable::NotificationIntervalAccessor(const Value& row)
index 223fd5543ba760e6cc08f4e24c8861d5c3d7caea..f6a6daf16122f49dc23e04f6bd054273b243542a 100644 (file)
@@ -67,7 +67,7 @@ void StatusTable::AddColumns(Table *table, const String& prefix,
        table->AddColumn(prefix + "program_start", Column(&StatusTable::ProgramStartAccessor, objectAccessor));
        table->AddColumn(prefix + "last_command_check", Column(&Table::ZeroAccessor, objectAccessor));
        table->AddColumn(prefix + "last_log_rotation", Column(&Table::ZeroAccessor, objectAccessor));
-       table->AddColumn(prefix + "interval_length", Column(&Table::ZeroAccessor, objectAccessor));
+       table->AddColumn(prefix + "interval_length", Column(&StatusTable::IntervalLengthAccessor, objectAccessor));
        table->AddColumn(prefix + "num_hosts", Column(&StatusTable::NumHostsAccessor, objectAccessor));
        table->AddColumn(prefix + "num_services", Column(&StatusTable::NumServicesAccessor, objectAccessor));
        table->AddColumn(prefix + "program_version", Column(&StatusTable::ProgramVersionAccessor, objectAccessor));
@@ -187,6 +187,11 @@ Value StatusTable::ProgramStartAccessor(const Value&)
        return static_cast<long>(Application::GetStartTime());
 }
 
+Value StatusTable::IntervalLengthAccessor(const Value&)
+{
+       return LIVESTATUS_INTERVAL_LENGTH;
+}
+
 Value StatusTable::NumHostsAccessor(const Value&)
 {
        return ConfigType::Get<Host>()->GetObjectCount();
index 65e572a91f33924ea5f6e96d5eefa12523b5bacb..2fba249ef014bbd418c13f9194e9d937efa6f2da 100644 (file)
@@ -45,6 +45,7 @@ protected:
        static Value EnableFlapDetectionAccessor(const Value& row);
        static Value ProcessPerformanceDataAccessor(const Value& row);
        static Value ProgramStartAccessor(const Value& row);
+       static Value IntervalLengthAccessor(const Value& row);
        static Value NumHostsAccessor(const Value& row);
        static Value NumServicesAccessor(const Value& row);
        static Value ProgramVersionAccessor(const Value& row);
index b5d829515a13b16ef09960653ec17f2ca103e1ba..fa3fc2a651592542aefc96012ab81347cab15efb 100644 (file)
@@ -12,6 +12,9 @@
 namespace icinga
 {
 
+// Well, don't ask.
+#define LIVESTATUS_INTERVAL_LENGTH 60.0
+
 struct LivestatusRowValue {
        Value Row;
        LivestatusGroupByType GroupByType;