Add imports support for Hostgroup

This commit is contained in:
Alexander Fuhr 2015-06-29 10:20:15 +02:00
parent 0af3ed4452
commit 878841e33e
7 changed files with 86 additions and 2 deletions

View File

@ -37,5 +37,10 @@ class IcingaHostGroupForm extends DirectorObjectForm
'label' => $this->translate('Display Name'),
'description' => $this->translate('The name which should displayed.')
));
$this->addElement('text', 'imports', array(
'label' => $this->translate('Imports'),
'description' => $this->translate('The inherited hostgroup template names')
));
}
}

View File

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

View File

@ -0,0 +1,17 @@
CREATE TABLE icinga_hostgroup_inheritance (
hostgroup_id INT(10) UNSIGNED NOT NULL,
parent_hostgroup_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (hostgroup_id, parent_hostgroup_id),
UNIQUE KEY unique_order (hostgroup_id, weight),
CONSTRAINT icinga_hostgroup_inheritance_hostgroup
FOREIGN KEY host (hostgroup_id)
REFERENCES icinga_hostgroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_hostgroup_inheritance_parent_hostgroup
FOREIGN KEY host (parent_hostgroup_id)
REFERENCES icinga_hostgroup (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -460,6 +460,24 @@ CREATE TABLE icinga_hostgroup (
KEY search_idx (display_name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_hostgroup_inheritance (
hostgroup_id INT(10) UNSIGNED NOT NULL,
parent_hostgroup_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (hostgroup_id, parent_hostgroup_id),
UNIQUE KEY unique_order (hostgroup_id, weight),
CONSTRAINT icinga_hostgroup_inheritance_hostgroup
FOREIGN KEY host (hostgroup_id)
REFERENCES icinga_hostgroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_hostgroup_inheritance_parent_hostgroup
FOREIGN KEY host (parent_hostgroup_id)
REFERENCES icinga_hostgroup (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_servicegroup (
id INT(10) UNSIGNED AUTO_INCREMENT NOT NULL,
object_name VARCHAR(255) DEFAULT NULL,

View File

@ -3,7 +3,7 @@ CREATE TABLE icinga_timeperiod_inheritance (
parent_timeperiod_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (timeperiod_id, parent_timeperiod_id),
CONSTRAINT icinga_timeperiod_inheritance_timeperiodr
CONSTRAINT icinga_timeperiod_inheritance_timeperiod
FOREIGN KEY (timeperiod_id)
REFERENCES icinga_timeperiod (id)
ON DELETE CASCADE

View File

@ -0,0 +1,20 @@
CREATE TABLE icinga_hostgroup_inheritance (
hostgroup_id integer NOT NULL,
parent_hostgroup_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (hostgroup_id, parent_hostgroup_id),
CONSTRAINT icinga_hostgroup_inheritance_hostgroup
FOREIGN KEY (hostgroup_id)
REFERENCES icinga_hostgroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_hostgroup_inheritance_parent_hostgroup
FOREIGN KEY (parent_hostgroup_id)
REFERENCES icinga_hostgroup (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX hostgroup_inheritance_unique_order ON icinga_hostgroup_inheritance (hostgroup_id, weight);
CREATE INDEX hostgroup_inheritance_hostgroup ON icinga_hostgroup_inheritance (hostgroup_id);
CREATE INDEX hostgroup_inheritance_hostgroup_parent ON icinga_hostgroup_inheritance (parent_hostgroup_id);

View File

@ -202,7 +202,7 @@ CREATE TABLE icinga_timeperiod_inheritance (
parent_timeperiod_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (timeperiod_id, parent_timeperiod_id),
CONSTRAINT icinga_timeperiod_inheritance_timeperiodr
CONSTRAINT icinga_timeperiod_inheritance_timeperiod
FOREIGN KEY (timeperiod_id)
REFERENCES icinga_timeperiod (id)
ON DELETE CASCADE
@ -566,6 +566,28 @@ CREATE UNIQUE INDEX hostgroup_object_name ON icinga_hostgroup (object_name);
CREATE INDEX hostgroup_search_idx ON icinga_hostgroup (display_name);
CREATE TABLE icinga_hostgroup_inheritance (
hostgroup_id integer NOT NULL,
parent_hostgroup_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (hostgroup_id, parent_hostgroup_id),
CONSTRAINT icinga_hostgroup_inheritance_hostgroup
FOREIGN KEY (hostgroup_id)
REFERENCES icinga_hostgroup (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_hostgroup_inheritance_parent_hostgroup
FOREIGN KEY (parent_hostgroup_id)
REFERENCES icinga_hostgroup (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX hostgroup_inheritance_unique_order ON icinga_hostgroup_inheritance (hostgroup_id, weight);
CREATE INDEX hostgroup_inheritance_hostgroup ON icinga_hostgroup_inheritance (hostgroup_id);
CREATE INDEX hostgroup_inheritance_hostgroup_parent ON icinga_hostgroup_inheritance (parent_hostgroup_id);
CREATE TABLE icinga_servicegroup (
id serial,
object_name character varying(255) DEFAULT NULL,