diff --git a/components/compat/statusdatawriter.cpp b/components/compat/statusdatawriter.cpp index 2a739e155..0d5322d14 100644 --- a/components/compat/statusdatawriter.cpp +++ b/components/compat/statusdatawriter.cpp @@ -241,8 +241,8 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host) "\t" "host_name" "\t" << host->GetName() << "\n" "\t" "display_name" "\t" << host->GetDisplayName() << "\n" "\t" "alias" "\t" << host->GetDisplayName() << "\n" - "\t" "address" "\t" << CompatUtility::GetHostAddress(host) << "\n" - "\t" "address6" "\t" << CompatUtility::GetHostAddress6(host) << "\n"; + "\t" "address" "\t" << host->GetAddress() << "\n" + "\t" "address6" "\t" << host->GetAddress6() << "\n"; if (!notes.IsEmpty()) fp << "\t" "notes" "\t" << notes << "\n"; if (!notes_url.IsEmpty()) @@ -340,7 +340,7 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl "\t" "check_interval=" << CompatUtility::GetCheckableCheckInterval(checkable) << "\n" "\t" "retry_interval=" << CompatUtility::GetCheckableRetryInterval(checkable) << "\n" "\t" "has_been_checked=" << CompatUtility::GetCheckableHasBeenChecked(checkable) << "\n" - "\t" "should_be_scheduled=" << CompatUtility::GetCheckableShouldBeScheduled(checkable) << "\n"; + "\t" "should_be_scheduled=" << checkable->GetEnableActiveChecks() << "\n"; if (cr) { fp << "\t" << "check_execution_time=" << Convert::ToString(Service::CalculateExecutionTime(cr)) << "\n" diff --git a/components/livestatus/hoststable.cpp b/components/livestatus/hoststable.cpp index 0fc7ff2da..dcf25137a 100644 --- a/components/livestatus/hoststable.cpp +++ b/components/livestatus/hoststable.cpp @@ -199,7 +199,7 @@ Value HostsTable::AddressAccessor(const Value& row) return Empty; - return CompatUtility::GetHostAddress(host); + return host->GetAddress(); } Value HostsTable::Address6Accessor(const Value& row) @@ -209,7 +209,7 @@ Value HostsTable::Address6Accessor(const Value& row) if (!host) return Empty; - return CompatUtility::GetHostAddress6(host); + return host->GetAddress6(); } Value HostsTable::CheckCommandAccessor(const Value& row) diff --git a/lib/db_ido/hostdbobject.cpp b/lib/db_ido/hostdbobject.cpp index 82e75ec7a..81da5ca3a 100644 --- a/lib/db_ido/hostdbobject.cpp +++ b/lib/db_ido/hostdbobject.cpp @@ -45,8 +45,8 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const fields->Set("alias", CompatUtility::GetHostAlias(host)); fields->Set("display_name", host->GetDisplayName()); - fields->Set("address", CompatUtility::GetHostAddress(host)); - fields->Set("address6", CompatUtility::GetHostAddress6(host)); + fields->Set("address", host->GetAddress()); + fields->Set("address6", host->GetAddress6()); fields->Set("check_command_object_id", host->GetCheckCommand()); fields->Set("check_command_args", Empty); @@ -134,7 +134,7 @@ Dictionary::Ptr HostDbObject::GetStatusFields(void) const fields->Set("current_state", host->IsReachable() ? host->GetState() : 2); fields->Set("has_been_checked", CompatUtility::GetCheckableHasBeenChecked(host)); - fields->Set("should_be_scheduled", CompatUtility::GetCheckableShouldBeScheduled(host)); + fields->Set("should_be_scheduled", host->GetEnableActiveChecks()); fields->Set("current_check_attempt", host->GetCheckAttempt()); fields->Set("max_check_attempts", host->GetMaxCheckAttempts()); diff --git a/lib/db_ido/servicedbobject.cpp b/lib/db_ido/servicedbobject.cpp index 1d356d3bd..c940817c8 100644 --- a/lib/db_ido/servicedbobject.cpp +++ b/lib/db_ido/servicedbobject.cpp @@ -117,7 +117,7 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const fields->Set("current_state", service->GetState()); fields->Set("has_been_checked", CompatUtility::GetCheckableHasBeenChecked(service)); - fields->Set("should_be_scheduled", CompatUtility::GetCheckableShouldBeScheduled(service)); + fields->Set("should_be_scheduled", service->GetEnableActiveChecks()); fields->Set("current_check_attempt", service->GetCheckAttempt()); fields->Set("max_check_attempts", service->GetMaxCheckAttempts()); diff --git a/lib/icinga/compatutility.cpp b/lib/icinga/compatutility.cpp index 6bca02715..40c7d244e 100644 --- a/lib/icinga/compatutility.cpp +++ b/lib/icinga/compatutility.cpp @@ -69,40 +69,6 @@ String CompatUtility::GetHostAlias(const Host::Ptr& host) return host->GetDisplayName(); } -String CompatUtility::GetHostAddress(const Host::Ptr& host) -{ - ASSERT(host->OwnsLock()); - - Dictionary::Ptr vars = host->GetVars(); - - String address; - - if (vars) - address = vars->Get("address"); - - if (address.IsEmpty()) - address = host->GetName(); - - return address; -} - -String CompatUtility::GetHostAddress6(const Host::Ptr& host) -{ - ASSERT(host->OwnsLock()); - - Dictionary::Ptr vars = host->GetVars(); - - String address6; - - if (vars) - address6 = vars->Get("address6"); - - if (address6.IsEmpty()) - address6 = host->GetName(); - - return address6; -} - Host2dCoords CompatUtility::GetHost2dCoords(const Host::Ptr& host) { ASSERT(host->OwnsLock()); @@ -177,13 +143,6 @@ int CompatUtility::GetHostNotifyOnUnreachable(const Host::Ptr& host) } /* service */ -int CompatUtility::GetCheckableShouldBeScheduled(const Checkable::Ptr& checkable) -{ - ASSERT(checkable->OwnsLock()); - - return (checkable->GetEnableActiveChecks() ? 1 : 0); -} - int CompatUtility::GetCheckableCheckType(const Checkable::Ptr& checkable) { ASSERT(checkable->OwnsLock()); diff --git a/lib/icinga/compatutility.h b/lib/icinga/compatutility.h index 0cb86213b..fb28a766b 100644 --- a/lib/icinga/compatutility.h +++ b/lib/icinga/compatutility.h @@ -50,8 +50,6 @@ public: /* host */ static String GetHostAlias(const Host::Ptr& host); - static String GetHostAddress(const Host::Ptr& host); - static String GetHostAddress6(const Host::Ptr& host); static Host2dCoords GetHost2dCoords(const Host::Ptr& host); static String GetHost2dCoordX(const Host::Ptr& host); static String GetHost2dCoordY(const Host::Ptr& host); @@ -59,7 +57,6 @@ public: static int GetHostNotifyOnUnreachable(const Host::Ptr& host); /* service */ - static int GetCheckableShouldBeScheduled(const Checkable::Ptr& checkable); static int GetCheckableCheckType(const Checkable::Ptr& checkable); static double GetCheckableCheckInterval(const Checkable::Ptr& checkable); static double GetCheckableRetryInterval(const Checkable::Ptr& checkable);