Drop Freshness wrappers from CompatUtility class

This commit is contained in:
Michael Friedrich 2017-12-06 15:35:27 +01:00
parent db6ed405e4
commit cbea0c13f5
6 changed files with 5 additions and 29 deletions

View 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());

View 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());

View 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())

View 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);

View 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);

View 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);