add new column evaluate_sla into table tservice
This commit is contained in:
parent
e1d41c25b1
commit
1b1bc4aa2e
|
@ -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;
|
|
@ -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`
|
||||
|
|
|
@ -10339,10 +10339,11 @@ function api_set_create_special_day($thrash1, $thrash2, $other, $thrash3) {
|
|||
*
|
||||
* @param $thrash1 Don't use.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param is <description>;<id_group>;<critical>;
|
||||
* @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>;
|
||||
* in this order and separator char (after text ; ) and separator
|
||||
* <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){
|
||||
|
@ -10441,10 +10446,11 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
*
|
||||
* @param $thrash1 service id.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's array, $other as param is <name>;<description>;<id_group>;<critical>;
|
||||
* @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>;
|
||||
* in this order and separator char (after text ; ) and separator
|
||||
* <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){
|
||||
|
@ -10565,10 +10577,10 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
*
|
||||
* @param $thrash1 service id.
|
||||
* @param $thrash2 Don't use.
|
||||
* @param array $other it's a json, $other as param is <description>;<id_group>;<critical>;
|
||||
* @param array $other it's a json, $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>;
|
||||
* in this order and separator char (after text ; ) and separator
|
||||
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;
|
||||
* 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
|
||||
*
|
||||
|
@ -10584,7 +10596,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
if (is_metaconsole()) return;
|
||||
|
||||
$id = $thrash1;
|
||||
|
||||
|
||||
if(empty($id)){
|
||||
returnError('error_add_service_element', __('Error adding elements to service. No service id'));
|
||||
return;
|
||||
|
@ -10613,7 +10625,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'module':
|
||||
$agent_id = 0;
|
||||
$id_service_child = 0;
|
||||
|
@ -10622,7 +10634,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'service':
|
||||
$agent_id = 0;
|
||||
$id_agente_modulo = 0;
|
||||
|
@ -10635,7 +10647,7 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$values = array(
|
||||
'id_agente_modulo' => $id_agente_modulo,
|
||||
'description' => $element['description'],
|
||||
|
@ -10647,20 +10659,20 @@ function api_set_add_element_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
'id_agent' => $agent_id,
|
||||
'id_service_child' => $id_service_child,
|
||||
'id_server_meta' => 0);
|
||||
|
||||
|
||||
$result = db_process_sql_insert('tservice_element',$values);
|
||||
if($result && !$results){
|
||||
$results = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($results){
|
||||
returnData('string', array('type' => 'string', 'data' => 1));
|
||||
} else {
|
||||
returnError('error_add_service_element', __('Error adding elements to service'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Update a special day. And return a message with the result of the operation.
|
||||
|
|
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue