diff --git a/application/forms/IcingaEndpointForm.php b/application/forms/IcingaEndpointForm.php index 73ece23a..afcbcde7 100644 --- a/application/forms/IcingaEndpointForm.php +++ b/application/forms/IcingaEndpointForm.php @@ -34,7 +34,7 @@ class IcingaEndpointForm extends DirectorObjectForm )); } - $this->addElement('text', 'address', array( + $this->addElement('text', 'host', array( 'label' => $this->translate('Endpoint address'), 'description' => $this->translate('IP address / hostname of remote node') )); diff --git a/application/tables/IcingaEndpointTable.php b/application/tables/IcingaEndpointTable.php index 47730798..7a424440 100644 --- a/application/tables/IcingaEndpointTable.php +++ b/application/tables/IcingaEndpointTable.php @@ -15,7 +15,7 @@ class IcingaEndpointTable extends QuickTable return array( 'id' => 'e.id', 'endpoint' => 'e.object_name', - 'address' => 'e.address', + 'host' => "(CASE WHEN e.host IS NULL THEN NULL ELSE CONCAT(e.host || ':' || COALESCE(e.port, 5665)) END)", 'zone' => 'z.object_name', ); } @@ -30,7 +30,7 @@ class IcingaEndpointTable extends QuickTable $view = $this->view(); return array( 'endpoint' => $view->translate('Endpoint'), - 'address' => $view->translate('Address'), + 'host' => $view->translate('Host'), 'zone' => $view->translate('Zone'), ); } diff --git a/library/Director/Objects/IcingaEndpoint.php b/library/Director/Objects/IcingaEndpoint.php index 8e0048ff..52f285bf 100644 --- a/library/Director/Objects/IcingaEndpoint.php +++ b/library/Director/Objects/IcingaEndpoint.php @@ -12,7 +12,7 @@ class IcingaEndpoint extends IcingaObject 'id' => null, 'zone_id' => null, 'object_name' => null, - 'address' => null, + 'host' => null, 'port' => null, 'log_duration' => null, 'object_type' => null, diff --git a/schema/mysql-changes/upgrade_52.sql b/schema/mysql-changes/upgrade_52.sql new file mode 100644 index 00000000..fad0d569 --- /dev/null +++ b/schema/mysql-changes/upgrade_52.sql @@ -0,0 +1,5 @@ +ALTER TABLE icinga_endpoint + MODIFY object_type ENUM('object', 'template', 'external_object') NOT NULL, + ADD COLUMN host VARCHAR(255) DEFAULT NULL COMMENT 'IP address / hostname of remote node' AFTER object_name, + DROP column address; + diff --git a/schema/mysql.sql b/schema/mysql.sql index a82eebe5..6c483538 100644 --- a/schema/mysql.sql +++ b/schema/mysql.sql @@ -322,10 +322,10 @@ CREATE TABLE icinga_endpoint ( id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL, zone_id INT(10) UNSIGNED DEFAULT NULL, object_name VARCHAR(255) NOT NULL, - address VARCHAR(255) DEFAULT NULL COMMENT 'IP address / hostname of remote node', + host VARCHAR(255) DEFAULT NULL COMMENT 'IP address / hostname of remote node', port SMALLINT UNSIGNED DEFAULT NULL COMMENT '5665 if not set', log_duration VARCHAR(32) DEFAULT NULL COMMENT '1d if not set', - object_type ENUM('object', 'template') NOT NULL, + object_type ENUM('object', 'template', 'external_object') NOT NULL, PRIMARY KEY (id), UNIQUE INDEX object_name (object_name), CONSTRAINT icinga_endpoint_zone