add cascade protection in services

This commit is contained in:
daniel 2018-06-22 14:59:17 +02:00
parent 17b726d7a0
commit 92fbc86ed9
1 changed files with 44 additions and 17 deletions

View File

@ -10368,6 +10368,8 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
$id_critical_module_template = $other['data'][9];
$id_unknown_module_template = 0;
$id_critical_module_sla = $other['data'][10];
$quiet = $other['data'][11];
$cascade_protection = $other['data'][12];
if(empty($name)){
returnError('error_create_service', __('Error in creation service. No name'));
@ -10411,11 +10413,21 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
if(empty($id_critical_module_sla)){
$id_critical_module_sla = 0;
}
if(empty($quiet)){
$quiet = 0;
}
if(empty($cascade_protection)){
$cascade_protection = 0;
}
$result = services_create_service ($name, $description, $id_group,
$critical, $warning, SECONDS_5MINUTES, $mode, $id_agent, $sla_interval, $sla_limit,
$result = services_create_service (
$name, $description, $id_group,
$critical, $warning, SECONDS_5MINUTES,
$mode, $id_agent, $sla_interval, $sla_limit,
$id_warning_module_template, $id_critical_module_template,
$id_unknown_module_template, $id_critical_module_sla);
$id_unknown_module_template, $id_critical_module_sla,
$quiet, $cascade_protection
);
if($result){
returnData('string', array('type' => 'string', 'data' => $result));
@ -10520,17 +10532,32 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
$id_critical_module_sla = $service['id_template_alert_critical_sla'];
}
$result = services_update_service ($id_service, $name,$description, $id_group, $critical, $warning,
SECONDS_5MINUTES, $mode, $id_agent,$sla_interval, $sla_limit,$id_warning_module_template,
$id_critical_module_template,$id_unknown_module_template,$id_critical_module_sla);
$quiet = $other['data'][11];
if(empty($quiet)){
$quiet = $service['quiet'];
}
$cascade_protection = $other['data'][12];
if(empty($cascade_protection)){
$cascade_protection = $service['cascade_protection'];
}
$result = services_update_service (
$id_service, $name,$description, $id_group,
$critical, $warning, SECONDS_5MINUTES, $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
);
if($result){
returnData('string', array('type' => 'string', 'data' => $result));
} else {
returnError('error_update_service', __('Error in update service'));
}
}
/**