Update components to use the new address fields.

Refs #5856
This commit is contained in:
Gunnar Beutner 2014-04-08 13:34:48 +02:00
parent 0fdb9ea21b
commit 80778bad1d
6 changed files with 9 additions and 53 deletions

View File

@ -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"

View File

@ -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)

View File

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

View File

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

View File

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

View File

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