Add imports support for Endpoint

This commit is contained in:
Alexander Fuhr 2015-06-29 11:11:56 +02:00
parent f1c3f9025b
commit 775bc67fec
6 changed files with 84 additions and 0 deletions

View File

@ -53,5 +53,10 @@ class IcingaEndpointForm extends DirectorObjectForm
'description' => $this->translate('Check this host in this specific Icinga cluster zone'),
'required' => true
));
$this->addElement('text', 'imports', array(
'label' => $this->translate('Imports'),
'description' => $this->translate('The inherited endpoint template names')
));
}
}

View File

@ -6,6 +6,8 @@ class IcingaEndpoint extends IcingaObject
{
protected $table = 'icinga_endpoint';
protected $supportsImports = true;
protected $defaultProperties = array(
'id' => null,
'zone_id' => null,

View File

@ -0,0 +1,17 @@
CREATE TABLE icinga_endpoint_inheritance (
endpoint_id INT(10) UNSIGNED NOT NULL,
parent_endpoint_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (endpoint_id, parent_endpoint_id),
UNIQUE KEY unique_order (endpoint_id, weight),
CONSTRAINT icinga_endpoint_inheritance_endpoint
FOREIGN KEY endpoint (endpoint_id)
REFERENCES icinga_endpoint (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_endpoint_inheritance_parent_endpoint
FOREIGN KEY endpoint (parent_endpoint_id)
REFERENCES icinga_endpoint (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -295,6 +295,24 @@ CREATE TABLE icinga_endpoint (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_endpoint_inheritance (
endpoint_id INT(10) UNSIGNED NOT NULL,
parent_endpoint_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (endpoint_id, parent_endpoint_id),
UNIQUE KEY unique_order (endpoint_id, weight),
CONSTRAINT icinga_endpoint_inheritance_endpoint
FOREIGN KEY endpoint (endpoint_id)
REFERENCES icinga_endpoint (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_endpoint_inheritance_parent_endpoint
FOREIGN KEY endpoint (parent_endpoint_id)
REFERENCES icinga_endpoint (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_host (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
object_name VARCHAR(255) NOT NULL,

View File

@ -0,0 +1,20 @@
CREATE TABLE icinga_endpoint_inheritance (
endpoint_id integer NOT NULL,
parent_endpoint_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (endpoint_id, parent_endpoint_id),
CONSTRAINT icinga_endpoint_inheritance_endpoint
FOREIGN KEY (endpoint_id)
REFERENCES icinga_endpoint (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_endpoint_inheritance_parent_endpoint
FOREIGN KEY (parent_endpoint_id)
REFERENCES icinga_endpoint (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX endpoint_inheritance_unique_order ON icinga_endpoint_inheritance (endpoint_id, weight);
CREATE INDEX endpoint_inheritance_endpoint ON icinga_endpoint_inheritance (endpoint_id);
CREATE INDEX endpoint_inheritance_endpoint_parent ON icinga_endpoint_inheritance (parent_endpoint_id);

View File

@ -375,6 +375,28 @@ COMMENT ON COLUMN icinga_endpoint.port IS '5665 if not set';
COMMENT ON COLUMN icinga_endpoint.log_duration IS '1d if not set';
CREATE TABLE icinga_endpoint_inheritance (
endpoint_id integer NOT NULL,
parent_endpoint_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (endpoint_id, parent_endpoint_id),
CONSTRAINT icinga_endpoint_inheritance_endpoint
FOREIGN KEY (endpoint_id)
REFERENCES icinga_endpoint (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_endpoint_inheritance_parent_endpoint
FOREIGN KEY (parent_endpoint_id)
REFERENCES icinga_endpoint (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX endpoint_inheritance_unique_order ON icinga_endpoint_inheritance (endpoint_id, weight);
CREATE INDEX endpoint_inheritance_endpoint ON icinga_endpoint_inheritance (endpoint_id);
CREATE INDEX endpoint_inheritance_endpoint_parent ON icinga_endpoint_inheritance (parent_endpoint_id);
CREATE TABLE icinga_host (
id serial,
object_name character varying(255) NOT NULL,