mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
smart services API adjustments
This commit is contained in:
parent
cf26293a33
commit
0b42d1b61f
@ -29,7 +29,7 @@
|
|||||||
// Begin.
|
// Begin.
|
||||||
require_once 'config.php';
|
require_once 'config.php';
|
||||||
require_once 'functions_api.php';
|
require_once 'functions_api.php';
|
||||||
|
require '../vendor/autoload.php';
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
define('DEBUG', 0);
|
define('DEBUG', 0);
|
||||||
|
@ -13123,6 +13123,9 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3)
|
|||||||
$quiet = $other['data'][11];
|
$quiet = $other['data'][11];
|
||||||
$cascade_protection = $other['data'][12];
|
$cascade_protection = $other['data'][12];
|
||||||
$evaluate_sla = $other['data'][13];
|
$evaluate_sla = $other['data'][13];
|
||||||
|
$is_favourite = $other['data'][14];
|
||||||
|
$unknown_as_critical = $other['data'][15];
|
||||||
|
$server_name = $other['data'][16];
|
||||||
|
|
||||||
if (empty($name)) {
|
if (empty($name)) {
|
||||||
returnError('error_create_service', __('Error in creation service. No name'));
|
returnError('error_create_service', __('Error in creation service. No name'));
|
||||||
@ -13189,24 +13192,39 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3)
|
|||||||
$evaluate_sla = 0;
|
$evaluate_sla = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = services_create_service(
|
if (empty($is_favourite)) {
|
||||||
$name,
|
$is_favourite = false;
|
||||||
$description,
|
}
|
||||||
$id_group,
|
|
||||||
$critical,
|
if (empty($unknown_as_critical)) {
|
||||||
$warning,
|
$unknown_as_critical = false;
|
||||||
SECONDS_5MINUTES,
|
}
|
||||||
$mode,
|
|
||||||
$id_agent,
|
if (empty($server_name)) {
|
||||||
$sla_interval,
|
$server_name = null;
|
||||||
$sla_limit,
|
}
|
||||||
$id_warning_module_template,
|
|
||||||
$id_critical_module_template,
|
$result = enterprise_hook(
|
||||||
$id_unknown_module_template,
|
'services_create_service',
|
||||||
$id_critical_module_sla,
|
[
|
||||||
$quiet,
|
$name,
|
||||||
$cascade_protection,
|
$description,
|
||||||
$evaluate_sla
|
$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,
|
||||||
|
$evaluate_sla,
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -13225,7 +13243,7 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3)
|
|||||||
* @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>;
|
* <warning>;<id_agent>;<sla_interval>;<sla_limit>;<id_warning_module_template_alert>;
|
||||||
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;<quiet>;
|
* <id_critical_module_template_alert>;<id_critical_module_sla_template_alert>;<quiet>;
|
||||||
* <cascade_protection>;<evaluate_sla>;
|
* <cascade_protection>;<evaluate_sla>;<is_favourite>;<unknown_as_critical>;<server_name>;
|
||||||
* in this order and separator char (after text ; ) and separator
|
* in this order and separator char (after text ; ) and separator
|
||||||
* (pass in param othermode as othermode=url_encode_separator_<separator>)
|
* (pass in param othermode as othermode=url_encode_separator_<separator>)
|
||||||
* @param $thrash3 Don't use
|
* @param $thrash3 Don't use
|
||||||
@ -13342,25 +13360,46 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3)
|
|||||||
$evaluate_sla = $service['evaluate_sla'];
|
$evaluate_sla = $service['evaluate_sla'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = services_update_service(
|
$is_favourite = $other['data'][14];
|
||||||
$id_service,
|
if (empty($is_favourite)) {
|
||||||
$name,
|
$is_favourite = $service['is_favourite'];
|
||||||
$description,
|
}
|
||||||
$id_group,
|
|
||||||
$critical,
|
$unknown_as_critical = $other['data'][15];
|
||||||
$warning,
|
if (empty($unknown_as_critical)) {
|
||||||
SECONDS_5MINUTES,
|
$unknown_as_critical = $service['unknown_as_critical'];
|
||||||
$mode,
|
}
|
||||||
$id_agent,
|
|
||||||
$sla_interval,
|
$server_name = $other['data'][16];
|
||||||
$sla_limit,
|
if (empty($server_name)) {
|
||||||
$id_warning_module_template,
|
$server_name = $service['server_name'];
|
||||||
$id_critical_module_template,
|
}
|
||||||
$id_unknown_module_template,
|
|
||||||
$id_critical_module_sla,
|
$result = enterprise_hook(
|
||||||
$quiet,
|
'services_update_service',
|
||||||
$cascade_protection,
|
[
|
||||||
$evaluate_sla
|
$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,
|
||||||
|
$evaluate_sla,
|
||||||
|
$is_favourite,
|
||||||
|
$unknown_as_critical,
|
||||||
|
$server_name,
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user