Add imports support to Service

This commit is contained in:
Alexander Fuhr 2015-06-26 16:20:16 +02:00
parent bc57937078
commit fd74a8dfd5
6 changed files with 85 additions and 0 deletions

View File

@ -84,5 +84,10 @@ class IcingaServiceForm extends DirectorObjectForm
'label' => $this->translate('Servicegroups'),
'description' => $this->translate('One or more comma separated servicegroup names')
));
$this->addElement('text', 'imports', array(
'label' => $this->translate('Imports'),
'description' => $this->translate('The inherited service template names')
));
}
}

View File

@ -38,6 +38,8 @@ class IcingaService extends IcingaObject
protected $supportsCustomVars = true;
protected $supportsImports = true;
protected function renderCheck_command_id()
{
return $this->renderCommandProperty($this->check_command_id);

View File

@ -0,0 +1,17 @@
CREATE TABLE icinga_service_inheritance (
service_id INT(10) UNSIGNED NOT NULL,
parent_service_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (service_id, parent_service_id),
UNIQUE KEY unique_order (service_id, weight),
CONSTRAINT icinga_service_inheritance_service
FOREIGN KEY host (service_id)
REFERENCES icinga_service (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_service_inheritance_parent_service
FOREIGN KEY host (parent_service_id)
REFERENCES icinga_service (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -384,6 +384,24 @@ CREATE TABLE icinga_service (
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_service_inheritance (
service_id INT(10) UNSIGNED NOT NULL,
parent_service_id INT(10) UNSIGNED NOT NULL,
weight MEDIUMINT UNSIGNED DEFAULT NULL,
PRIMARY KEY (service_id, parent_service_id),
UNIQUE KEY unique_order (service_id, weight),
CONSTRAINT icinga_service_inheritance_service
FOREIGN KEY host (service_id)
REFERENCES icinga_service (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_service_inheritance_parent_service
FOREIGN KEY host (parent_service_id)
REFERENCES icinga_service (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE icinga_service_var (
service_id INT(10) UNSIGNED NOT NULL,
varname VARCHAR(255) DEFAULT NULL,

View File

@ -0,0 +1,21 @@
CREATE TABLE icinga_service_inheritance (
service_id integer NOT NULL,
parent_service_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (service_id, parent_service_id),
CONSTRAINT icinga_service_inheritance_service
FOREIGN KEY (service_id)
REFERENCES icinga_service (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_service_inheritance_parent_service
FOREIGN KEY (parent_service_id)
REFERENCES icinga_service (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX service_inheritance_unique_order ON icinga_service_inheritance (service_id, weight);
CREATE INDEX service_inheritance_service ON icinga_service_inheritance (service_id);
CREATE INDEX service_inheritance_service_parent ON icinga_service_inheritance (parent_service_id);

View File

@ -473,6 +473,28 @@ CREATE INDEX service_event_command ON icinga_service (event_command_id);
CREATE INDEX service_command_endpoint ON icinga_service (command_endpoint_id);
CREATE TABLE icinga_service_inheritance (
service_id integer NOT NULL,
parent_service_id integer NOT NULL,
weight integer DEFAULT NULL,
PRIMARY KEY (service_id, parent_service_id),
CONSTRAINT icinga_service_inheritance_service
FOREIGN KEY (service_id)
REFERENCES icinga_service (id)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_service_inheritance_parent_service
FOREIGN KEY (parent_service_id)
REFERENCES icinga_service (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
);
CREATE UNIQUE INDEX service_inheritance_unique_order ON icinga_service_inheritance (service_id, weight);
CREATE INDEX service_inheritance_service ON icinga_service_inheritance (service_id);
CREATE INDEX service_inheritance_service_parent ON icinga_service_inheritance (parent_service_id);
CREATE TABLE icinga_service_var (
service_id integer NOT NULL,
varname character varying(255) DEFAULT NULL,