add new column evaluate_sla into table tservice

This commit is contained in:
daniel 2018-06-28 13:34:55 +02:00
parent e1d41c25b1
commit 1b1bc4aa2e
4 changed files with 34 additions and 18 deletions

View File

@ -10,4 +10,6 @@ ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
ALTER TABLE `tservice` ADD COLUMN `evaluate_sla` int(1) NOT NULL DEFAULT '0';
COMMIT;

View File

@ -1269,6 +1269,7 @@ UPDATE tagente SET tagente.alias = tagente.nombre;
ALTER TABLE `tservice` ADD COLUMN `quiet` tinyint(1) NOT NULL default 0;
ALTER TABLE `tservice` ADD COLUMN `cps` int NOT NULL default 0;
ALTER TABLE `tservice` ADD COLUMN `cascade_protection` tinyint(1) NOT NULL default 0;
ALTER TABLE `tservice` ADD COLUMN `evaluate_sla` int(1) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tlayout`

View File

@ -10341,7 +10341,8 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3) {
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param is <description>;<id_group>;<critical>;
* <warning>;<id_agent>;<sla_interval>;<sla_limit>;<id_warning_module_template_alert>;
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;<quiet>;
* <cascade_protection>;<evaluate_sla>;
* in this order and separator char (after text ; ) and separator
* (pass in param othermode as othermode=url_encode_separator_<separator>)
* @param $thrash3 Don't use
@ -10370,6 +10371,7 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
$id_critical_module_sla = $other['data'][10];
$quiet = $other['data'][11];
$cascade_protection = $other['data'][12];
$evaluate_sla = $other['data'][13];
if(empty($name)){
returnError('error_create_service', __('Error in creation service. No name'));
@ -10419,6 +10421,9 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
if(empty($cascade_protection)){
$cascade_protection = 0;
}
if(empty($evaluate_sla)){
$evaluate_sla = 0;
}
$result = services_create_service (
$name, $description, $id_group,
@ -10426,7 +10431,7 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
$mode, $id_agent, $sla_interval, $sla_limit,
$id_warning_module_template, $id_critical_module_template,
$id_unknown_module_template, $id_critical_module_sla,
$quiet, $cascade_protection
$quiet, $cascade_protection, $evaluate_sla
);
if($result){
@ -10443,7 +10448,8 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param is <name>;<description>;<id_group>;<critical>;
* <warning>;<id_agent>;<sla_interval>;<sla_limit>;<id_warning_module_template_alert>;
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;<quiet>;
* <cascade_protection>;<evaluate_sla>;
* in this order and separator char (after text ; ) and separator
* (pass in param othermode as othermode=url_encode_separator_<separator>)
* @param $thrash3 Don't use
@ -10542,6 +10548,11 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
$cascade_protection = $service['cascade_protection'];
}
$evaluate_sla = $other['data'][13];
if(empty($evaluate_sla)){
$evaluate_sla = $service['evaluate_sla'];
}
$result = services_update_service (
$id_service, $name,$description, $id_group,
$critical, $warning, SECONDS_5MINUTES, $mode,
@ -10550,7 +10561,8 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
$id_critical_module_template,
$id_unknown_module_template,
$id_critical_module_sla,
$quiet, $cascade_protection
$quiet, $cascade_protection,
$evaluate_sla
);
if($result){

View File

@ -2429,6 +2429,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
`quiet` tinyint(1) NOT NULL default 0,
`cps` int NOT NULL default 0,
`cascade_protection` tinyint(1) NOT NULL default 0,
`evaluate_sla` int(1) NOT NULL default 0,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
COMMENT = 'Table to define services to monitor'