mirror of https://github.com/Icinga/icinga2.git
parent
fe1a83ff34
commit
c8b3fde2ef
|
@ -235,7 +235,6 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
|
||||||
String action_url = host->GetActionUrl();
|
String action_url = host->GetActionUrl();
|
||||||
String icon_image = host->GetIconImage();
|
String icon_image = host->GetIconImage();
|
||||||
String icon_image_alt = host->GetIconImageAlt();
|
String icon_image_alt = host->GetIconImageAlt();
|
||||||
String statusmap_image = CompatUtility::GetCustomAttributeConfig(host, "statusmap_image");
|
|
||||||
String display_name = host->GetDisplayName();
|
String display_name = host->GetDisplayName();
|
||||||
String address = host->GetAddress();
|
String address = host->GetAddress();
|
||||||
String address6 = host->GetAddress6();
|
String address6 = host->GetAddress6();
|
||||||
|
@ -260,8 +259,6 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
|
||||||
fp << "\t" "icon_image" "\t" << icon_image << "\n";
|
fp << "\t" "icon_image" "\t" << icon_image << "\n";
|
||||||
if (!icon_image_alt.IsEmpty())
|
if (!icon_image_alt.IsEmpty())
|
||||||
fp << "\t" "icon_image_alt" "\t" << icon_image_alt << "\n";
|
fp << "\t" "icon_image_alt" "\t" << icon_image_alt << "\n";
|
||||||
if (!statusmap_image.IsEmpty())
|
|
||||||
fp << "\t" "statusmap_image" "\t" << statusmap_image << "\n";
|
|
||||||
|
|
||||||
std::set<Checkable::Ptr> parents = host->GetParents();
|
std::set<Checkable::Ptr> parents = host->GetParents();
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
|
||||||
table->AddColumn(prefix + "icon_image", Column(&HostsTable::IconImageAccessor, objectAccessor));
|
table->AddColumn(prefix + "icon_image", Column(&HostsTable::IconImageAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "icon_image_expanded", Column(&HostsTable::IconImageExpandedAccessor, objectAccessor));
|
table->AddColumn(prefix + "icon_image_expanded", Column(&HostsTable::IconImageExpandedAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "icon_image_alt", Column(&HostsTable::IconImageAltAccessor, objectAccessor));
|
table->AddColumn(prefix + "icon_image_alt", Column(&HostsTable::IconImageAltAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "statusmap_image", Column(&HostsTable::StatusmapImageAccessor, objectAccessor));
|
table->AddColumn(prefix + "statusmap_image", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "long_plugin_output", Column(&HostsTable::LongPluginOutputAccessor, objectAccessor));
|
table->AddColumn(prefix + "long_plugin_output", Column(&HostsTable::LongPluginOutputAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "initial_state", Column(&Table::EmptyStringAccessor, objectAccessor));
|
table->AddColumn(prefix + "initial_state", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "max_check_attempts", Column(&HostsTable::MaxCheckAttemptsAccessor, objectAccessor));
|
table->AddColumn(prefix + "max_check_attempts", Column(&HostsTable::MaxCheckAttemptsAccessor, objectAccessor));
|
||||||
|
@ -118,8 +118,8 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
|
||||||
table->AddColumn(prefix + "x_3d", Column(&EmptyStringAccessor, objectAccessor));
|
table->AddColumn(prefix + "x_3d", Column(&EmptyStringAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "y_3d", Column(&EmptyStringAccessor, objectAccessor));
|
table->AddColumn(prefix + "y_3d", Column(&EmptyStringAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "z_3d", Column(&EmptyStringAccessor, objectAccessor));
|
table->AddColumn(prefix + "z_3d", Column(&EmptyStringAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "x_2d", Column(&HostsTable::X2dAccessor, objectAccessor));
|
table->AddColumn(prefix + "x_2d", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "y_2d", Column(&HostsTable::Y2dAccessor, objectAccessor));
|
table->AddColumn(prefix + "y_2d", Column(&Table::EmptyStringAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "latency", Column(&HostsTable::LatencyAccessor, objectAccessor));
|
table->AddColumn(prefix + "latency", Column(&HostsTable::LatencyAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "execution_time", Column(&HostsTable::ExecutionTimeAccessor, objectAccessor));
|
table->AddColumn(prefix + "execution_time", Column(&HostsTable::ExecutionTimeAccessor, objectAccessor));
|
||||||
table->AddColumn(prefix + "percent_state_change", Column(&HostsTable::PercentStateChangeAccessor, objectAccessor));
|
table->AddColumn(prefix + "percent_state_change", Column(&HostsTable::PercentStateChangeAccessor, objectAccessor));
|
||||||
|
@ -412,16 +412,6 @@ Value HostsTable::IconImageAltAccessor(const Value& row)
|
||||||
return host->GetIconImageAlt();
|
return host->GetIconImageAlt();
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::StatusmapImageAccessor(const Value& row)
|
|
||||||
{
|
|
||||||
Host::Ptr host = static_cast<Host::Ptr>(row);
|
|
||||||
|
|
||||||
if (!host)
|
|
||||||
return Empty;
|
|
||||||
|
|
||||||
return CompatUtility::GetCustomAttributeConfig(host, "statusmap_image");
|
|
||||||
}
|
|
||||||
|
|
||||||
Value HostsTable::LongPluginOutputAccessor(const Value& row)
|
Value HostsTable::LongPluginOutputAccessor(const Value& row)
|
||||||
{
|
{
|
||||||
Host::Ptr host = static_cast<Host::Ptr>(row);
|
Host::Ptr host = static_cast<Host::Ptr>(row);
|
||||||
|
@ -814,26 +804,6 @@ Value HostsTable::HighFlapThresholdAccessor(const Value& row)
|
||||||
return CompatUtility::GetCheckableHighFlapThreshold(host);
|
return CompatUtility::GetCheckableHighFlapThreshold(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value HostsTable::X2dAccessor(const Value& row)
|
|
||||||
{
|
|
||||||
Host::Ptr host = static_cast<Host::Ptr>(row);
|
|
||||||
|
|
||||||
if (!host)
|
|
||||||
return Empty;
|
|
||||||
|
|
||||||
return CompatUtility::GetHost2dCoordX(host);
|
|
||||||
}
|
|
||||||
|
|
||||||
Value HostsTable::Y2dAccessor(const Value& row)
|
|
||||||
{
|
|
||||||
Host::Ptr host = static_cast<Host::Ptr>(row);
|
|
||||||
|
|
||||||
if (!host)
|
|
||||||
return Empty;
|
|
||||||
|
|
||||||
return CompatUtility::GetHost2dCoordY(host);
|
|
||||||
}
|
|
||||||
|
|
||||||
Value HostsTable::LatencyAccessor(const Value& row)
|
Value HostsTable::LatencyAccessor(const Value& row)
|
||||||
{
|
{
|
||||||
Host::Ptr host = static_cast<Host::Ptr>(row);
|
Host::Ptr host = static_cast<Host::Ptr>(row);
|
||||||
|
|
|
@ -65,7 +65,6 @@ protected:
|
||||||
static Value IconImageAccessor(const Value& row);
|
static Value IconImageAccessor(const Value& row);
|
||||||
static Value IconImageExpandedAccessor(const Value& row);
|
static Value IconImageExpandedAccessor(const Value& row);
|
||||||
static Value IconImageAltAccessor(const Value& row);
|
static Value IconImageAltAccessor(const Value& row);
|
||||||
static Value StatusmapImageAccessor(const Value& row);
|
|
||||||
static Value LongPluginOutputAccessor(const Value& row);
|
static Value LongPluginOutputAccessor(const Value& row);
|
||||||
static Value MaxCheckAttemptsAccessor(const Value& row);
|
static Value MaxCheckAttemptsAccessor(const Value& row);
|
||||||
static Value FlapDetectionEnabledAccessor(const Value& row);
|
static Value FlapDetectionEnabledAccessor(const Value& row);
|
||||||
|
@ -106,8 +105,6 @@ protected:
|
||||||
static Value NotificationIntervalAccessor(const Value& row);
|
static Value NotificationIntervalAccessor(const Value& row);
|
||||||
static Value LowFlapThresholdAccessor(const Value& row);
|
static Value LowFlapThresholdAccessor(const Value& row);
|
||||||
static Value HighFlapThresholdAccessor(const Value& row);
|
static Value HighFlapThresholdAccessor(const Value& row);
|
||||||
static Value X2dAccessor(const Value& row);
|
|
||||||
static Value Y2dAccessor(const Value& row);
|
|
||||||
static Value LatencyAccessor(const Value& row);
|
static Value LatencyAccessor(const Value& row);
|
||||||
static Value ExecutionTimeAccessor(const Value& row);
|
static Value ExecutionTimeAccessor(const Value& row);
|
||||||
static Value PercentStateChangeAccessor(const Value& row);
|
static Value PercentStateChangeAccessor(const Value& row);
|
||||||
|
|
|
@ -9,8 +9,7 @@ user interface.
|
||||||
|
|
||||||
Some interface features will only work in a limited manner due to
|
Some interface features will only work in a limited manner due to
|
||||||
[compatibility reasons](#differences-1x-2), other features like the
|
[compatibility reasons](#differences-1x-2), other features like the
|
||||||
statusmap parents are available through intelligent compatibility layers
|
statusmap parents are available dumping the host dependencies as parents.
|
||||||
for dumping the host dependencies as parents.
|
|
||||||
Special restrictions are noted specifically in the sections below.
|
Special restrictions are noted specifically in the sections below.
|
||||||
|
|
||||||
> **Tip**
|
> **Tip**
|
||||||
|
|
|
@ -52,10 +52,6 @@ Attributes:
|
||||||
> The `address` and `address6` attributes are required for running commands using
|
> The `address` and `address6` attributes are required for running commands using
|
||||||
> the `$address$` and `$address6` runtime macros.
|
> the `$address$` and `$address6` runtime macros.
|
||||||
|
|
||||||
Unlike Icinga 1.x the `statusmap_image` and `2d_coords` attributes are
|
|
||||||
custom attributes only in Icinga 2.
|
|
||||||
|
|
||||||
|
|
||||||
### <a id="objecttype-hostgroup"></a> HostGroup
|
### <a id="objecttype-hostgroup"></a> HostGroup
|
||||||
|
|
||||||
A group of hosts.
|
A group of hosts.
|
||||||
|
|
|
@ -168,29 +168,15 @@ Icinga 2 allows you to define custom attributes in the `vars` dictionary.
|
||||||
The `notes`, `notes_url`, `action_url`, `icon_image`, `icon_image_alt`
|
The `notes`, `notes_url`, `action_url`, `icon_image`, `icon_image_alt`
|
||||||
attributes for host and service objects are still available in Icinga 2.
|
attributes for host and service objects are still available in Icinga 2.
|
||||||
|
|
||||||
### <a id="differences-1x-2-action-url-notes-url-notes"></a> Statusmap Image, 2D Coords
|
`2d_coords` and `statusmap_image` are not supported in Icinga 2.
|
||||||
|
|
||||||
These attributes can be set using the `vars` dictionary in Icinga 2 `Host`
|
|
||||||
or `Service` objects:
|
|
||||||
|
|
||||||
vars = {
|
|
||||||
"2d_coords" = "1,2"
|
|
||||||
statusmap_image = "../../images/logos/icinga.gif"
|
|
||||||
}
|
|
||||||
|
|
||||||
External interfaces will recognize and display these attributes accordingly.
|
|
||||||
|
|
||||||
### <a id="differences-1x-2-custom-variables"></a> Custom Variables
|
### <a id="differences-1x-2-custom-variables"></a> Custom Variables
|
||||||
|
|
||||||
Icinga 1.x custom variable attributes must be prefixed using an underscore (`_`).
|
Icinga 1.x custom variable attributes must be prefixed using an underscore (`_`).
|
||||||
In Icinga 2 these attributes must be added to the `vars` dictionary as custom attributes.
|
In Icinga 2 these attributes must be added to the `vars` dictionary as custom attributes.
|
||||||
|
|
||||||
vars = {
|
vars.dn = "cn=icinga2-dev-host,ou=icinga,ou=main,ou=IcingaConfig,ou=LConf,dc=icinga,dc=org"
|
||||||
DN = "cn=icinga2-dev-host,ou=icinga,ou=main,ou=IcingaConfig,ou=LConf,dc=icinga,dc=org"
|
vars.cv = "my custom cmdb description"
|
||||||
CV = "my custom cmdb description"
|
|
||||||
}
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
## <a id="differences-1x-2-host-service-relation"></a> Host Service Relation
|
## <a id="differences-1x-2-host-service-relation"></a> Host Service Relation
|
||||||
|
|
||||||
|
|
|
@ -102,19 +102,6 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const
|
||||||
fields->Set("action_url", host->GetActionUrl());
|
fields->Set("action_url", host->GetActionUrl());
|
||||||
fields->Set("icon_image", host->GetIconImage());
|
fields->Set("icon_image", host->GetIconImage());
|
||||||
fields->Set("icon_image_alt", host->GetIconImageAlt());
|
fields->Set("icon_image_alt", host->GetIconImageAlt());
|
||||||
fields->Set("statusmap_image", CompatUtility::GetCustomAttributeConfig(host, "statusmap_image"));
|
|
||||||
|
|
||||||
Host2dCoords coords = CompatUtility::GetHost2dCoords(host);
|
|
||||||
|
|
||||||
fields->Set("have_2d_coords", coords.have_2d_coords);
|
|
||||||
|
|
||||||
if (coords.have_2d_coords) {
|
|
||||||
fields->Set("x_2d", coords.x_2d);
|
|
||||||
fields->Set("y_2d", coords.y_2d);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* deprecated in 1.x */
|
|
||||||
fields->Set("have_3d_coords", 0);
|
|
||||||
|
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,54 +70,6 @@ String CompatUtility::GetHostAlias(const Host::Ptr& host)
|
||||||
return host->GetDisplayName();
|
return host->GetDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Host2dCoords CompatUtility::GetHost2dCoords(const Host::Ptr& host)
|
|
||||||
{
|
|
||||||
ASSERT(host->OwnsLock());
|
|
||||||
|
|
||||||
Dictionary::Ptr vars = host->GetVars();
|
|
||||||
Host2dCoords bag;
|
|
||||||
|
|
||||||
if (vars) {
|
|
||||||
String coords = vars->Get("2d_coords");
|
|
||||||
bag.have_2d_coords = (!coords.IsEmpty() ? 1 : 0);
|
|
||||||
|
|
||||||
std::vector<String> tokens;
|
|
||||||
boost::algorithm::split(tokens, coords, boost::is_any_of(","));
|
|
||||||
|
|
||||||
if (tokens.size() != 2)
|
|
||||||
bag.have_2d_coords = 0;
|
|
||||||
|
|
||||||
if (bag.have_2d_coords == 1) {
|
|
||||||
bag.x_2d = tokens[0];
|
|
||||||
bag.y_2d = tokens[1];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bag.have_2d_coords = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bag;
|
|
||||||
}
|
|
||||||
|
|
||||||
String CompatUtility::GetHost2dCoordX(const Host::Ptr& host)
|
|
||||||
{
|
|
||||||
Host2dCoords bag = GetHost2dCoords(host);
|
|
||||||
|
|
||||||
if (bag.have_2d_coords == 0)
|
|
||||||
return Empty;
|
|
||||||
|
|
||||||
return bag.x_2d;
|
|
||||||
}
|
|
||||||
|
|
||||||
String CompatUtility::GetHost2dCoordY(const Host::Ptr& host)
|
|
||||||
{
|
|
||||||
Host2dCoords bag = GetHost2dCoords(host);
|
|
||||||
|
|
||||||
if (bag.have_2d_coords == 0)
|
|
||||||
return Empty;
|
|
||||||
|
|
||||||
return bag.y_2d;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CompatUtility::GetHostNotifyOnDown(const Host::Ptr& host)
|
int CompatUtility::GetHostNotifyOnDown(const Host::Ptr& host)
|
||||||
{
|
{
|
||||||
ASSERT(host->OwnsLock());
|
ASSERT(host->OwnsLock());
|
||||||
|
@ -371,9 +323,7 @@ int CompatUtility::GetCheckableInNotificationPeriod(const Checkable::Ptr& checka
|
||||||
bool CompatUtility::IsLegacyAttribute(DynamicObject::Ptr const& object, const String& name)
|
bool CompatUtility::IsLegacyAttribute(DynamicObject::Ptr const& object, const String& name)
|
||||||
{
|
{
|
||||||
if ((name == "address" ||
|
if ((name == "address" ||
|
||||||
name == "address6" ||
|
name == "address6") &&
|
||||||
name == "statusmap_image" ||
|
|
||||||
name == "2d_coords") &&
|
|
||||||
object->GetType() == DynamicType::GetByName("Host"))
|
object->GetType() == DynamicType::GetByName("Host"))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -392,7 +342,7 @@ bool CompatUtility::IsLegacyAttribute(DynamicObject::Ptr const& object, const St
|
||||||
name == "action_url" ||
|
name == "action_url" ||
|
||||||
name == "notes_url" ||
|
name == "notes_url" ||
|
||||||
name == "icon_image" ||
|
name == "icon_image" ||
|
||||||
name == "icon_image_alt") &&
|
name == "icon_image_alt") &&
|
||||||
(object->GetType() == DynamicType::GetByName("Host") ||
|
(object->GetType() == DynamicType::GetByName("Host") ||
|
||||||
object->GetType() == DynamicType::GetByName("Service")))
|
object->GetType() == DynamicType::GetByName("Service")))
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -31,15 +31,6 @@
|
||||||
namespace icinga
|
namespace icinga
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* @ingroup icinga
|
|
||||||
*/
|
|
||||||
struct Host2dCoords {
|
|
||||||
int have_2d_coords;
|
|
||||||
String x_2d;
|
|
||||||
String y_2d;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compatibility utility functions.
|
* Compatibility utility functions.
|
||||||
*
|
*
|
||||||
|
@ -51,9 +42,6 @@ public:
|
||||||
|
|
||||||
/* host */
|
/* host */
|
||||||
static String GetHostAlias(const Host::Ptr& host);
|
static String GetHostAlias(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);
|
|
||||||
static int GetHostNotifyOnDown(const Host::Ptr& host);
|
static int GetHostNotifyOnDown(const Host::Ptr& host);
|
||||||
static int GetHostNotifyOnUnreachable(const Host::Ptr& host);
|
static int GetHostNotifyOnUnreachable(const Host::Ptr& host);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue