mirror of https://github.com/Icinga/icinga2.git
Drop CompatUtility::GetCheckable*Interval() and hardcode their minute representation in compat features
This commit is contained in:
parent
fb76287d39
commit
d373b03907
|
@ -264,8 +264,8 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
|
||||||
|
|
||||||
ObjectLock olock(host);
|
ObjectLock olock(host);
|
||||||
|
|
||||||
fp << "\t" "check_interval" "\t" << CompatUtility::GetCheckableCheckInterval(host) << "\n"
|
fp << "\t" "check_interval" "\t" << (host->GetCheckInterval() / 60.0) << "\n"
|
||||||
"\t" "retry_interval" "\t" << CompatUtility::GetCheckableRetryInterval(host) << "\n"
|
"\t" "retry_interval" "\t" << (host->GetRetryInterval() / 60.0) << "\n"
|
||||||
"\t" "max_check_attempts" "\t" << host->GetMaxCheckAttempts() << "\n"
|
"\t" "max_check_attempts" "\t" << host->GetMaxCheckAttempts() << "\n"
|
||||||
"\t" "active_checks_enabled" "\t" << Convert::ToLong(host->GetEnableActiveChecks()) << "\n"
|
"\t" "active_checks_enabled" "\t" << Convert::ToLong(host->GetEnableActiveChecks()) << "\n"
|
||||||
"\t" "passive_checks_enabled" "\t" << Convert::ToLong(host->GetEnablePassiveChecks()) << "\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"
|
fp << "\t" << "check_command=" << CompatUtility::GetCommandName(checkcommand) << "!" << CompatUtility::GetCheckableCommandArgs(checkable) << "\n"
|
||||||
"\t" "event_handler=" << CompatUtility::GetCommandName(eventcommand) << "\n"
|
"\t" "event_handler=" << CompatUtility::GetCommandName(eventcommand) << "\n"
|
||||||
"\t" "check_interval=" << CompatUtility::GetCheckableCheckInterval(checkable) << "\n"
|
"\t" "check_interval=" << (checkable->GetCheckInterval() / 60.0) << "\n"
|
||||||
"\t" "retry_interval=" << CompatUtility::GetCheckableRetryInterval(checkable) << "\n"
|
"\t" "retry_interval=" << (checkable->GetRetryInterval() / 60.0) << "\n"
|
||||||
"\t" "has_been_checked=" << Convert::ToLong(checkable->HasBeenChecked()) << "\n"
|
"\t" "has_been_checked=" << Convert::ToLong(checkable->HasBeenChecked()) << "\n"
|
||||||
"\t" "should_be_scheduled=" << checkable->GetEnableActiveChecks() << "\n"
|
"\t" "should_be_scheduled=" << checkable->GetEnableActiveChecks() << "\n"
|
||||||
"\t" "event_handler_enabled=" << Convert::ToLong(checkable->GetEnableEventHandler()) << "\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" "host_name" "\t" << host->GetName() << "\n"
|
||||||
"\t" "service_description" "\t" << service->GetShortName() << "\n"
|
"\t" "service_description" "\t" << service->GetShortName() << "\n"
|
||||||
"\t" "display_name" "\t" << service->GetDisplayName() << "\n"
|
"\t" "display_name" "\t" << service->GetDisplayName() << "\n"
|
||||||
"\t" "check_interval" "\t" << CompatUtility::GetCheckableCheckInterval(service) << "\n"
|
"\t" "check_interval" "\t" << (service->GetCheckInterval() / 60.0) << "\n"
|
||||||
"\t" "retry_interval" "\t" << CompatUtility::GetCheckableRetryInterval(service) << "\n"
|
"\t" "retry_interval" "\t" << (service->GetRetryInterval() / 60.0) << "\n"
|
||||||
"\t" "max_check_attempts" "\t" << service->GetMaxCheckAttempts() << "\n"
|
"\t" "max_check_attempts" "\t" << service->GetMaxCheckAttempts() << "\n"
|
||||||
"\t" "active_checks_enabled" "\t" << Convert::ToLong(service->GetEnableActiveChecks()) << "\n"
|
"\t" "active_checks_enabled" "\t" << Convert::ToLong(service->GetEnableActiveChecks()) << "\n"
|
||||||
"\t" "passive_checks_enabled" "\t" << Convert::ToLong(service->GetEnablePassiveChecks()) << "\n"
|
"\t" "passive_checks_enabled" "\t" << Convert::ToLong(service->GetEnablePassiveChecks()) << "\n"
|
||||||
|
|
|
@ -68,8 +68,8 @@ Dictionary::Ptr HostDbObject::GetConfigFields() const
|
||||||
fields->Set("notification_timeperiod_object_id", Empty);
|
fields->Set("notification_timeperiod_object_id", Empty);
|
||||||
fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
|
fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
|
||||||
fields->Set("failure_prediction_options", Empty);
|
fields->Set("failure_prediction_options", Empty);
|
||||||
fields->Set("check_interval", CompatUtility::GetCheckableCheckInterval(host));
|
fields->Set("check_interval", (host->GetCheckInterval() / 60.0));
|
||||||
fields->Set("retry_interval", CompatUtility::GetCheckableRetryInterval(host));
|
fields->Set("retry_interval", (host->GetRetryInterval() / 60.0));
|
||||||
fields->Set("max_check_attempts", host->GetMaxCheckAttempts());
|
fields->Set("max_check_attempts", host->GetMaxCheckAttempts());
|
||||||
|
|
||||||
fields->Set("first_notification_delay", Empty);
|
fields->Set("first_notification_delay", Empty);
|
||||||
|
@ -173,8 +173,8 @@ Dictionary::Ptr HostDbObject::GetStatusFields() const
|
||||||
fields->Set("failure_prediction_enabled", Empty);
|
fields->Set("failure_prediction_enabled", Empty);
|
||||||
fields->Set("process_performance_data", host->GetEnablePerfdata());
|
fields->Set("process_performance_data", host->GetEnablePerfdata());
|
||||||
fields->Set("obsess_over_host", Empty);
|
fields->Set("obsess_over_host", Empty);
|
||||||
fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(host));
|
fields->Set("normal_check_interval", (host->GetCheckInterval() / 60.0));
|
||||||
fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(host));
|
fields->Set("retry_check_interval", (host->GetRetryInterval() / 60.0));
|
||||||
fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
|
fields->Set("check_timeperiod_object_id", host->GetCheckPeriod());
|
||||||
fields->Set("is_reachable", host->IsReachable());
|
fields->Set("is_reachable", host->IsReachable());
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,8 @@ Dictionary::Ptr ServiceDbObject::GetConfigFields() const
|
||||||
fields->Set("notification_timeperiod_object_id", Empty);
|
fields->Set("notification_timeperiod_object_id", Empty);
|
||||||
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
||||||
fields->Set("failure_prediction_options", Empty);
|
fields->Set("failure_prediction_options", Empty);
|
||||||
fields->Set("check_interval", CompatUtility::GetCheckableCheckInterval(service));
|
fields->Set("check_interval", (service->GetCheckInterval() / 60.0));
|
||||||
fields->Set("retry_interval", CompatUtility::GetCheckableRetryInterval(service));
|
fields->Set("retry_interval", (service->GetRetryInterval() / 60.0));
|
||||||
fields->Set("max_check_attempts", service->GetMaxCheckAttempts());
|
fields->Set("max_check_attempts", service->GetMaxCheckAttempts());
|
||||||
fields->Set("first_notification_delay", Empty);
|
fields->Set("first_notification_delay", Empty);
|
||||||
fields->Set("notification_interval", CompatUtility::GetCheckableNotificationNotificationInterval(service));
|
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("scheduled_downtime_depth", service->GetDowntimeDepth());
|
||||||
fields->Set("process_performance_data", service->GetEnablePerfdata());
|
fields->Set("process_performance_data", service->GetEnablePerfdata());
|
||||||
fields->Set("normal_check_interval", CompatUtility::GetCheckableCheckInterval(service));
|
fields->Set("normal_check_interval", (service->GetCheckInterval() / 60.0));
|
||||||
fields->Set("retry_check_interval", CompatUtility::GetCheckableRetryInterval(service));
|
fields->Set("retry_check_interval", (service->GetRetryInterval() / 60.0));
|
||||||
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
fields->Set("check_timeperiod_object_id", service->GetCheckPeriod());
|
||||||
fields->Set("is_reachable", service->IsReachable());
|
fields->Set("is_reachable", service->IsReachable());
|
||||||
|
|
||||||
|
|
|
@ -188,18 +188,6 @@ String CompatUtility::GetCheckableCommandArgs(const Checkable::Ptr& checkable)
|
||||||
return Empty;
|
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. */
|
/* Used in Livestatus. */
|
||||||
int CompatUtility::GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable)
|
int CompatUtility::GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,8 +47,6 @@ public:
|
||||||
|
|
||||||
/* service */
|
/* service */
|
||||||
static String GetCheckableCommandArgs(const Checkable::Ptr& checkable);
|
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 GetCheckableNoMoreNotifications(const Checkable::Ptr& checkable);
|
||||||
static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable);
|
static int GetCheckableInNotificationPeriod(const Checkable::Ptr& checkable);
|
||||||
|
|
|
@ -789,7 +789,7 @@ Value HostsTable::CheckIntervalAccessor(const Value& row)
|
||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return CompatUtility::GetCheckableCheckInterval(host);
|
return host->GetCheckInterval() / 60.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::RetryIntervalAccessor(const Value& row)
|
Value HostsTable::RetryIntervalAccessor(const Value& row)
|
||||||
|
@ -799,7 +799,7 @@ Value HostsTable::RetryIntervalAccessor(const Value& row)
|
||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return CompatUtility::GetCheckableRetryInterval(host);
|
return host->GetRetryInterval() / 60.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::NotificationIntervalAccessor(const Value& row)
|
Value HostsTable::NotificationIntervalAccessor(const Value& row)
|
||||||
|
|
|
@ -810,7 +810,7 @@ Value ServicesTable::CheckIntervalAccessor(const Value& row)
|
||||||
if (!service)
|
if (!service)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return CompatUtility::GetCheckableCheckInterval(service);
|
return service->GetCheckInterval() / 60.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ServicesTable::RetryIntervalAccessor(const Value& row)
|
Value ServicesTable::RetryIntervalAccessor(const Value& row)
|
||||||
|
@ -820,7 +820,7 @@ Value ServicesTable::RetryIntervalAccessor(const Value& row)
|
||||||
if (!service)
|
if (!service)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return CompatUtility::GetCheckableRetryInterval(service);
|
return service->GetRetryInterval() / 60.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value ServicesTable::NotificationIntervalAccessor(const Value& row)
|
Value ServicesTable::NotificationIntervalAccessor(const Value& row)
|
||||||
|
|
Loading…
Reference in New Issue