mirror of https://github.com/Icinga/icinga2.git
parent
0fdb9ea21b
commit
80778bad1d
|
@ -241,8 +241,8 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
|
||||||
"\t" "host_name" "\t" << host->GetName() << "\n"
|
"\t" "host_name" "\t" << host->GetName() << "\n"
|
||||||
"\t" "display_name" "\t" << host->GetDisplayName() << "\n"
|
"\t" "display_name" "\t" << host->GetDisplayName() << "\n"
|
||||||
"\t" "alias" "\t" << host->GetDisplayName() << "\n"
|
"\t" "alias" "\t" << host->GetDisplayName() << "\n"
|
||||||
"\t" "address" "\t" << CompatUtility::GetHostAddress(host) << "\n"
|
"\t" "address" "\t" << host->GetAddress() << "\n"
|
||||||
"\t" "address6" "\t" << CompatUtility::GetHostAddress6(host) << "\n";
|
"\t" "address6" "\t" << host->GetAddress6() << "\n";
|
||||||
if (!notes.IsEmpty())
|
if (!notes.IsEmpty())
|
||||||
fp << "\t" "notes" "\t" << notes << "\n";
|
fp << "\t" "notes" "\t" << notes << "\n";
|
||||||
if (!notes_url.IsEmpty())
|
if (!notes_url.IsEmpty())
|
||||||
|
@ -340,7 +340,7 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl
|
||||||
"\t" "check_interval=" << CompatUtility::GetCheckableCheckInterval(checkable) << "\n"
|
"\t" "check_interval=" << CompatUtility::GetCheckableCheckInterval(checkable) << "\n"
|
||||||
"\t" "retry_interval=" << CompatUtility::GetCheckableRetryInterval(checkable) << "\n"
|
"\t" "retry_interval=" << CompatUtility::GetCheckableRetryInterval(checkable) << "\n"
|
||||||
"\t" "has_been_checked=" << CompatUtility::GetCheckableHasBeenChecked(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) {
|
if (cr) {
|
||||||
fp << "\t" << "check_execution_time=" << Convert::ToString(Service::CalculateExecutionTime(cr)) << "\n"
|
fp << "\t" << "check_execution_time=" << Convert::ToString(Service::CalculateExecutionTime(cr)) << "\n"
|
||||||
|
|
|
@ -199,7 +199,7 @@ Value HostsTable::AddressAccessor(const Value& row)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
|
|
||||||
return CompatUtility::GetHostAddress(host);
|
return host->GetAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::Address6Accessor(const Value& row)
|
Value HostsTable::Address6Accessor(const Value& row)
|
||||||
|
@ -209,7 +209,7 @@ Value HostsTable::Address6Accessor(const Value& row)
|
||||||
if (!host)
|
if (!host)
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return CompatUtility::GetHostAddress6(host);
|
return host->GetAddress6();
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::CheckCommandAccessor(const Value& row)
|
Value HostsTable::CheckCommandAccessor(const Value& row)
|
||||||
|
|
|
@ -45,8 +45,8 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const
|
||||||
|
|
||||||
fields->Set("alias", CompatUtility::GetHostAlias(host));
|
fields->Set("alias", CompatUtility::GetHostAlias(host));
|
||||||
fields->Set("display_name", host->GetDisplayName());
|
fields->Set("display_name", host->GetDisplayName());
|
||||||
fields->Set("address", CompatUtility::GetHostAddress(host));
|
fields->Set("address", host->GetAddress());
|
||||||
fields->Set("address6", CompatUtility::GetHostAddress6(host));
|
fields->Set("address6", host->GetAddress6());
|
||||||
|
|
||||||
fields->Set("check_command_object_id", host->GetCheckCommand());
|
fields->Set("check_command_object_id", host->GetCheckCommand());
|
||||||
fields->Set("check_command_args", Empty);
|
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("current_state", host->IsReachable() ? host->GetState() : 2);
|
||||||
fields->Set("has_been_checked", CompatUtility::GetCheckableHasBeenChecked(host));
|
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("current_check_attempt", host->GetCheckAttempt());
|
||||||
fields->Set("max_check_attempts", host->GetMaxCheckAttempts());
|
fields->Set("max_check_attempts", host->GetMaxCheckAttempts());
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ Dictionary::Ptr ServiceDbObject::GetStatusFields(void) const
|
||||||
|
|
||||||
fields->Set("current_state", service->GetState());
|
fields->Set("current_state", service->GetState());
|
||||||
fields->Set("has_been_checked", CompatUtility::GetCheckableHasBeenChecked(service));
|
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("current_check_attempt", service->GetCheckAttempt());
|
||||||
fields->Set("max_check_attempts", service->GetMaxCheckAttempts());
|
fields->Set("max_check_attempts", service->GetMaxCheckAttempts());
|
||||||
|
|
||||||
|
|
|
@ -69,40 +69,6 @@ String CompatUtility::GetHostAlias(const Host::Ptr& host)
|
||||||
return host->GetDisplayName();
|
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)
|
Host2dCoords CompatUtility::GetHost2dCoords(const Host::Ptr& host)
|
||||||
{
|
{
|
||||||
ASSERT(host->OwnsLock());
|
ASSERT(host->OwnsLock());
|
||||||
|
@ -177,13 +143,6 @@ int CompatUtility::GetHostNotifyOnUnreachable(const Host::Ptr& host)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* service */
|
/* service */
|
||||||
int CompatUtility::GetCheckableShouldBeScheduled(const Checkable::Ptr& checkable)
|
|
||||||
{
|
|
||||||
ASSERT(checkable->OwnsLock());
|
|
||||||
|
|
||||||
return (checkable->GetEnableActiveChecks() ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int CompatUtility::GetCheckableCheckType(const Checkable::Ptr& checkable)
|
int CompatUtility::GetCheckableCheckType(const Checkable::Ptr& checkable)
|
||||||
{
|
{
|
||||||
ASSERT(checkable->OwnsLock());
|
ASSERT(checkable->OwnsLock());
|
||||||
|
|
|
@ -50,8 +50,6 @@ public:
|
||||||
|
|
||||||
/* host */
|
/* host */
|
||||||
static String GetHostAlias(const Host::Ptr& 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 Host2dCoords GetHost2dCoords(const Host::Ptr& host);
|
||||||
static String GetHost2dCoordX(const Host::Ptr& host);
|
static String GetHost2dCoordX(const Host::Ptr& host);
|
||||||
static String GetHost2dCoordY(const Host::Ptr& host);
|
static String GetHost2dCoordY(const Host::Ptr& host);
|
||||||
|
@ -59,7 +57,6 @@ public:
|
||||||
static int GetHostNotifyOnUnreachable(const Host::Ptr& host);
|
static int GetHostNotifyOnUnreachable(const Host::Ptr& host);
|
||||||
|
|
||||||
/* service */
|
/* service */
|
||||||
static int GetCheckableShouldBeScheduled(const Checkable::Ptr& checkable);
|
|
||||||
static int GetCheckableCheckType(const Checkable::Ptr& checkable);
|
static int GetCheckableCheckType(const Checkable::Ptr& checkable);
|
||||||
static double GetCheckableCheckInterval(const Checkable::Ptr& checkable);
|
static double GetCheckableCheckInterval(const Checkable::Ptr& checkable);
|
||||||
static double GetCheckableRetryInterval(const Checkable::Ptr& checkable);
|
static double GetCheckableRetryInterval(const Checkable::Ptr& checkable);
|
||||||
|
|
Loading…
Reference in New Issue