Merge branch '2075-Proteccion_en_cascada_de_servicios' into 'develop'
2075 proteccion en cascada de servicios See merge request artica/pandorafms!1578
This commit is contained in:
commit
905e6bfc56
|
@ -0,0 +1,13 @@
|
|||
START TRANSACTION;
|
||||
|
||||
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 `tagente` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
|
||||
|
||||
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
|
||||
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL DEFAULT '0';
|
||||
|
||||
COMMIT;
|
|
@ -395,7 +395,7 @@ CREATE TABLE IF NOT EXISTS `tservice` (
|
|||
`id_template_alert_warning` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_critical` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_unknown` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = 'Table to define services to monitor'
|
||||
|
@ -1175,7 +1175,7 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 17);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 18);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||
|
@ -1229,6 +1229,7 @@ ALTER TABLE tusuario ADD COLUMN `time_autorefresh` int(5) unsigned NOT NULL defa
|
|||
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_next` bigint(20) NOT NULL default '0';
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `dynamic_two_tailed` tinyint(1) unsigned default '0';
|
||||
ALTER TABLE tagente_modulo ADD COLUMN `parent_module_id` int(10) unsigned NOT NULL;
|
||||
ALTER TABLE `tagente_modulo` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tagente_datos`
|
||||
|
@ -1258,8 +1259,17 @@ ALTER TABLE tagente ADD COLUMN `cascade_protection_module` int(10) unsigned NOT
|
|||
ALTER TABLE tagente ADD COLUMN (alias varchar(600) not null default '');
|
||||
ALTER TABLE tagente ADD `alias_as_name` int(2) unsigned default '0';
|
||||
ALTER TABLE tagente ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tagente` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
|
||||
UPDATE tagente SET tagente.alias = tagente.nombre;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tservice`
|
||||
-- ---------------------------------------------------------------------
|
||||
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;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tlayout`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
@ -1353,6 +1363,7 @@ ALTER TABLE tmetaconsole_agent ADD COLUMN `transactional_agent` tinyint(1) NOT N
|
|||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias` VARCHAR(600) not null DEFAULT '';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `alias_as_name` int(2) unsigned default '0';
|
||||
ALTER TABLE tmetaconsole_agent ADD COLUMN `safe_mode_module` int(10) unsigned NOT NULL default '0';
|
||||
ALTER TABLE `tmetaconsole_agent` ADD COLUMN `cps` int NOT NULL default 0;
|
||||
|
||||
UPDATE `tmetaconsole_agent` SET tmetaconsole_agent.alias = tmetaconsole_agent.nombre;
|
||||
-- ---------------------------------------------------------------------
|
||||
|
|
|
@ -515,9 +515,24 @@ $table->data[4][3] = html_print_input_text ('url_description',
|
|||
$url_description, '', 45, 255, true);
|
||||
|
||||
$table->data[5][2] = __('Quiet');
|
||||
$table->data[5][3] = ui_print_help_tip(
|
||||
__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[5][3] .= html_print_checkbox('quiet', 1, $quiet, true);
|
||||
$table->data[5][3] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
|
||||
$table->data[5][3] = html_print_checkbox('quiet', 1, $quiet, true);
|
||||
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if($cps > 0){
|
||||
$cps_array[$cps] = __('Enabled');
|
||||
}
|
||||
else{
|
||||
$cps_inc = 0;
|
||||
if($id_agente){
|
||||
$cps_inc = service_agents_cps($id_agente);
|
||||
}
|
||||
$cps_array[$cps_inc] = __('Enabled');
|
||||
}
|
||||
|
||||
$table->data[6][0] = __('Cascade protection services');
|
||||
$table->data[6][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table->data[6][1] = html_print_select($cps_array, 'cps', $cps, '', '', 0, true);
|
||||
|
||||
ui_toggle(html_print_table ($table, true), __('Advanced options'));
|
||||
unset($table);
|
||||
|
|
|
@ -84,6 +84,7 @@ $direccion_agente = io_safe_input($direccion_agente);
|
|||
$intervalo = SECONDS_5MINUTES;
|
||||
$ff_interval = 0;
|
||||
$quiet_module = 0;
|
||||
$cps_module = 0;
|
||||
$id_server = "";
|
||||
$max_alerts = 0;
|
||||
$modo = 1;
|
||||
|
@ -148,6 +149,7 @@ $tab_description = '';
|
|||
$url_description = '';
|
||||
$quiet = 0;
|
||||
$macros = '';
|
||||
$cps = 0;
|
||||
|
||||
$create_agent = (bool)get_parameter('create_agent');
|
||||
$module_macros = array ();
|
||||
|
@ -161,7 +163,7 @@ if ($create_agent) {
|
|||
|
||||
//safe_output only validate ip
|
||||
$direccion_agente = trim(io_safe_output($direccion_agente));
|
||||
|
||||
|
||||
if(!validate_address($direccion_agente)){
|
||||
$mssg_warning = 1;
|
||||
}
|
||||
|
@ -187,11 +189,13 @@ if ($create_agent) {
|
|||
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
|
||||
$url_description = (string) get_parameter("url_description");
|
||||
$quiet = (int) get_parameter("quiet", 0);
|
||||
$cps = (int) get_parameter("cps", 0);
|
||||
|
||||
$secondary_groups = (string) get_parameter("secondary_hidden", "");
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
|
||||
if ($fields === false) $fields = array();
|
||||
|
||||
|
||||
$field_values = array();
|
||||
|
||||
foreach ($fields as $field) {
|
||||
|
@ -216,8 +220,10 @@ if ($create_agent) {
|
|||
}
|
||||
|
||||
if(!$exists_alias){
|
||||
$id_agente = db_process_sql_insert ('tagente',
|
||||
array ('nombre' => $nombre_agente,
|
||||
$id_agente = db_process_sql_insert (
|
||||
'tagente',
|
||||
array (
|
||||
'nombre' => $nombre_agente,
|
||||
'alias' => $alias,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'direccion' => $direccion_agente,
|
||||
|
@ -235,7 +241,10 @@ if ($create_agent) {
|
|||
'icon_path' => $icon_path,
|
||||
'update_gis_data' => $update_gis_data,
|
||||
'url_address' => $url_description,
|
||||
'quiet' => $quiet));
|
||||
'quiet' => $quiet,
|
||||
'cps' => $cps
|
||||
)
|
||||
);
|
||||
enterprise_hook ('update_agent', array ($id_agente));
|
||||
}
|
||||
else{
|
||||
|
@ -253,19 +262,19 @@ if ($create_agent) {
|
|||
if ( $direccion_agente != '') {
|
||||
agents_add_address ($id_agente, $direccion_agente);
|
||||
}
|
||||
|
||||
|
||||
$agent_created_ok = true;
|
||||
|
||||
|
||||
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = ".$grupo);
|
||||
|
||||
|
||||
if($tpolicy_group_old){
|
||||
foreach ($tpolicy_group_old as $key => $old_group) {
|
||||
db_process_sql_insert ('tpolicy_agents',
|
||||
array('id_policy' => $old_group['id_policy'], 'id_agent' => $id_agente));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$info = '{"Name":"' . $nombre_agente .'",
|
||||
"IP":"' . $direccion_agente .'",
|
||||
"Group":"' . $grupo .'",
|
||||
|
@ -282,7 +291,8 @@ if ($create_agent) {
|
|||
"Icon path":"' . $icon_path .'",
|
||||
"Update GIS data":"' . $update_gis_data .'",
|
||||
"Url description":"' . $url_description .'",
|
||||
"Quiet":"' . (int)$quiet.'"}';
|
||||
"Quiet":"' . (int)$quiet.'",
|
||||
"Cps":"' . (int)$cps.'"}';
|
||||
|
||||
// Create the secondary groups
|
||||
enterprise_hook('agents_update_secondary_groups',
|
||||
|
@ -748,6 +758,7 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
$update_gis_data = (int) get_parameter_post("update_gis_data", 0);
|
||||
$url_description = (string) get_parameter("url_description");
|
||||
$quiet = (int) get_parameter("quiet", 0);
|
||||
$cps = (int) get_parameter("cps", 0);
|
||||
|
||||
$old_interval = db_get_value('intervalo', 'tagente', 'id_agente', $id_agente);
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
@ -799,47 +810,49 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
$direccion_agente != agents_get_address ($id_agente)) {
|
||||
agents_add_address ($id_agente, $direccion_agente);
|
||||
}
|
||||
|
||||
|
||||
$action_delete_ip = (bool)get_parameter('delete_ip', false);
|
||||
//If IP is set for deletion, delete first
|
||||
if ($action_delete_ip) {
|
||||
$delete_ip = get_parameter_post ("address_list");
|
||||
|
||||
|
||||
$direccion_agente = agents_delete_address($id_agente, $delete_ip);
|
||||
}
|
||||
|
||||
$values = array ('disabled' => $disabled,
|
||||
'id_parent' => $id_parent,
|
||||
'id_os' => $id_os,
|
||||
'modo' => $modo,
|
||||
'alias' => $alias,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'direccion' => $direccion_agente,
|
||||
'id_grupo' => $grupo,
|
||||
'intervalo' => $intervalo,
|
||||
'comentarios' => $comentarios,
|
||||
'cascade_protection' => $cascade_protection,
|
||||
'cascade_protection_module' => $cascade_protection_module,
|
||||
'server_name' => $server_name,
|
||||
'custom_id' => $custom_id,
|
||||
'icon_path' => $icon_path,
|
||||
'update_gis_data' => $update_gis_data,
|
||||
'url_address' => $url_description,
|
||||
'url_address' => $url_description,
|
||||
'quiet' => $quiet,
|
||||
'safe_mode_module' => $safe_mode_module);
|
||||
|
||||
|
||||
$values = array (
|
||||
'disabled' => $disabled,
|
||||
'id_parent' => $id_parent,
|
||||
'id_os' => $id_os,
|
||||
'modo' => $modo,
|
||||
'alias' => $alias,
|
||||
'alias_as_name' => $alias_as_name,
|
||||
'direccion' => $direccion_agente,
|
||||
'id_grupo' => $grupo,
|
||||
'intervalo' => $intervalo,
|
||||
'comentarios' => $comentarios,
|
||||
'cascade_protection' => $cascade_protection,
|
||||
'cascade_protection_module' => $cascade_protection_module,
|
||||
'server_name' => $server_name,
|
||||
'custom_id' => $custom_id,
|
||||
'icon_path' => $icon_path,
|
||||
'update_gis_data' => $update_gis_data,
|
||||
'url_address' => $url_description,
|
||||
'url_address' => $url_description,
|
||||
'quiet' => $quiet,
|
||||
'cps' => $cps,
|
||||
'safe_mode_module' => $safe_mode_module
|
||||
);
|
||||
|
||||
if ($config['metaconsole_agent_cache'] == 1) {
|
||||
$values['update_module_count'] = 1; // Force an update of the agent cache.
|
||||
}
|
||||
|
||||
|
||||
$group_old = db_get_sql("SELECT id_grupo FROM tagente WHERE id_agente =" .$id_agente);
|
||||
$tpolicy_group_old = db_get_all_rows_sql("SELECT id_policy FROM tpolicy_groups
|
||||
WHERE id_group = ".$group_old);
|
||||
|
||||
|
||||
$result = db_process_sql_update ('tagente', $values, array ('id_agente' => $id_agente));
|
||||
|
||||
|
||||
|
||||
if ($result == false && $update_custom_result == false) {
|
||||
ui_print_error_message(
|
||||
__('There was a problem updating the agent'));
|
||||
|
@ -873,7 +886,7 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
foreach ($tpolicy_group as $key => $value) {
|
||||
$tpolicy_agents= db_get_sql("SELECT * FROM tpolicy_agents
|
||||
WHERE id_policy = ".$value['id_policy'] . " AND id_agent =" .$id_agente);
|
||||
|
||||
|
||||
if(!$tpolicy_agents){
|
||||
db_process_sql_insert ('tpolicy_agents',
|
||||
array('id_policy' => $value['id_policy'], 'id_agent' => $id_agente));
|
||||
|
@ -884,7 +897,7 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$info = '{
|
||||
"id_agente":"' . $id_agente . '",
|
||||
"alias":"' . $alias . '",
|
||||
|
@ -902,8 +915,9 @@ if ($update_agent) { // if modified some agent paramenter
|
|||
"Icon Path":"' . $icon_path . '",
|
||||
"Update GIS data":"' .$update_gis_data .'",
|
||||
"Url description":"' . $url_description .'",
|
||||
"Quiet":"' . (int)$quiet.'"}';
|
||||
|
||||
"Quiet":"' . (int)$quiet.'",
|
||||
"Cps":"' . (int)$cps.'"}';
|
||||
|
||||
enterprise_hook ('update_agent', array ($id_agente));
|
||||
ui_print_success_message (__('Successfully updated'));
|
||||
db_pandora_audit("Agent management",
|
||||
|
@ -923,14 +937,14 @@ if ($id_agente) {
|
|||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$agent = db_get_row ('tagente', 'id_agente', $id_agente);
|
||||
if (empty ($agent)) {
|
||||
//Close out the page
|
||||
ui_print_error_message (__('There was a problem loading the agent'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$intervalo = $agent["intervalo"]; // Define interval in seconds
|
||||
$nombre_agente = $agent["nombre"];
|
||||
if(empty($alias)){
|
||||
|
@ -956,6 +970,7 @@ if ($id_agente) {
|
|||
$update_gis_data = $agent["update_gis_data"];
|
||||
$url_description = $agent["url_address"];
|
||||
$quiet = $agent["quiet"];
|
||||
$cps = $agent["cps"];
|
||||
$safe_mode_module = $agent["safe_mode_module"];
|
||||
$safe_mode = ($safe_mode_module) ? 1 : 0;
|
||||
}
|
||||
|
@ -972,7 +987,7 @@ $edit_module = (bool) get_parameter ('edit_module');
|
|||
// GET DATA for MODULE UPDATE OR MODULE INSERT
|
||||
if ($update_module || $create_module) {
|
||||
$id_grupo = agents_get_agent_group ($id_agente);
|
||||
|
||||
|
||||
$id_agent_module = (int) get_parameter ('id_agent_module');
|
||||
|
||||
if (!check_acl ($config["id_user"], $id_grupo, "AW")) {
|
||||
|
@ -1006,6 +1021,7 @@ if ($update_module || $create_module) {
|
|||
$interval = (int) get_parameter ('module_interval', $intervalo);
|
||||
$ff_interval = (int) get_parameter ('module_ff_interval');
|
||||
$quiet_module = (int) get_parameter ('quiet_module');
|
||||
$cps_module = (int) get_parameter ('cps_module');
|
||||
$id_plugin = (int) get_parameter ('id_plugin');
|
||||
$id_export = (int) get_parameter ('id_export');
|
||||
$disabled = (bool) get_parameter ('disabled');
|
||||
|
@ -1323,6 +1339,7 @@ if ($update_module) {
|
|||
'unit' => io_safe_output($unit),
|
||||
'macros' => $macros,
|
||||
'quiet' => $quiet_module,
|
||||
'cps' => $cps_module,
|
||||
'critical_instructions' => $critical_instructions,
|
||||
'warning_instructions' => $warning_instructions,
|
||||
'unknown_instructions' => $unknown_instructions,
|
||||
|
@ -1367,8 +1384,8 @@ if ($update_module) {
|
|||
}
|
||||
else {
|
||||
$check_dynamic =
|
||||
db_get_row_sql('SELECT dynamic_interval, dynamic_max, dynamic_min, dynamic_two_tailed
|
||||
FROM tagente_modulo WHERE id_agente_modulo =' . $id_agent_module);
|
||||
db_get_row_sql('SELECT dynamic_interval, dynamic_max, dynamic_min, dynamic_two_tailed
|
||||
FROM tagente_modulo WHERE id_agente_modulo =' . $id_agent_module);
|
||||
|
||||
if( ($check_dynamic['dynamic_interval'] == $dynamic_interval) &&
|
||||
($check_dynamic['dynamic_max'] == $dynamic_max) &&
|
||||
|
@ -1505,6 +1522,7 @@ if ($create_module) {
|
|||
'unit' => io_safe_output($unit),
|
||||
'macros' => $macros,
|
||||
'quiet' => $quiet_module,
|
||||
'cps' => $cps_module,
|
||||
'critical_instructions' => $critical_instructions,
|
||||
'warning_instructions' => $warning_instructions,
|
||||
'unknown_instructions' => $unknown_instructions,
|
||||
|
|
|
@ -162,6 +162,7 @@ if ($id_agent_module) {
|
|||
}
|
||||
$ff_interval = $module['module_ff_interval'];
|
||||
$quiet_module = $module['quiet'];
|
||||
$cps_module = $module['cps'];
|
||||
$unit = $module['unit'];
|
||||
$tcp_port = $module['tcp_port'];
|
||||
$tcp_send = $module['tcp_send'];
|
||||
|
@ -289,7 +290,7 @@ if ($id_agent_module) {
|
|||
else {
|
||||
if (!isset ($moduletype)) {
|
||||
$moduletype = (string) get_parameter ('moduletype');
|
||||
|
||||
|
||||
// Clean up specific network modules fields
|
||||
$name = '';
|
||||
$description = '';
|
||||
|
@ -302,6 +303,7 @@ else {
|
|||
$max = '';
|
||||
$interval = '';
|
||||
$quiet_module = 0;
|
||||
$cps_module = 0;
|
||||
$unit = '';
|
||||
$prediction_module = '';
|
||||
$custom_integer_1 = 0;
|
||||
|
@ -314,7 +316,7 @@ else {
|
|||
$tcp_send = '';
|
||||
$tcp_rcv = '';
|
||||
$tcp_port = '';
|
||||
|
||||
|
||||
if ($moduletype == "wmiserver")
|
||||
$snmp_community = '';
|
||||
else
|
||||
|
|
|
@ -566,11 +566,24 @@ if ($__code_from == 'modules') {
|
|||
}
|
||||
|
||||
$table_advanced->data[7][0] = __('Quiet');
|
||||
$table_advanced->data[7][0] .= ui_print_help_tip(
|
||||
__('The module still stores data but the alerts and events will be stop'), true);
|
||||
$table_advanced->colspan[7][1] = 7;
|
||||
$table_advanced->data[7][1] = html_print_checkbox('quiet_module', 1,
|
||||
$quiet_module, true, $disabledBecauseInPolicy);
|
||||
$table_advanced->data[7][0] .= ui_print_help_tip(__('The module still stores data but the alerts and events will be stop'), true);
|
||||
$table_advanced->data[7][1] = html_print_checkbox('quiet_module', 1, $quiet_module, true, $disabledBecauseInPolicy);
|
||||
|
||||
$cps_array[-1] = __('Disabled');
|
||||
if($cps_module > 0){
|
||||
$cps_array[$cps_module] = __('Enabled');
|
||||
}
|
||||
else{
|
||||
$cps_inc = 0;
|
||||
if($id_agent_module){
|
||||
$cps_inc = service_modules_cps($id_agent_module);
|
||||
}
|
||||
$cps_array[$cps_inc] = __('Enabled');
|
||||
}
|
||||
$table_advanced->data[7][2] = __('Cascade Protection Services');
|
||||
$table_advanced->data[7][2] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true);
|
||||
$table_advanced->colspan[7][3] = 5;
|
||||
$table_advanced->data[7][3] = html_print_select($cps_array, 'cps_module', $cps_module, '', '', 0, true, false, true, "", $disabledBecauseInPolicy);
|
||||
|
||||
$table_advanced->data[8][0] = __('Critical instructions') .
|
||||
ui_print_help_tip(__("Instructions when the status is critical"), true);
|
||||
|
|
|
@ -82,7 +82,7 @@ if ($update_agents) {
|
|||
$values['delete_conf'] = get_parameter('delete_conf');
|
||||
if (get_parameter('quiet_select', -1) != -1)
|
||||
$values['quiet'] = get_parameter('quiet_select');
|
||||
|
||||
|
||||
$fields = db_get_all_fields_in_table('tagent_custom_fields');
|
||||
|
||||
if ($fields === false) $fields = array();
|
||||
|
|
|
@ -635,21 +635,23 @@ $table->data['edit11'][0] .= ui_print_help_tip(__('The module still store data b
|
|||
$table->data['edit11'][1] = html_print_select(array(-1 => __('No change'),
|
||||
1 => __('Yes'), 0 => __('No')),
|
||||
"quiet_select", -1, "", '', 0, true);
|
||||
|
||||
|
||||
|
||||
$table->data['edit11'][2] = __('Timeout');
|
||||
$table->data['edit11'][3] = html_print_input_text(
|
||||
'max_timeout', '', '', 5, 10, true) . ' ' .
|
||||
ui_print_help_tip (
|
||||
__('Seconds that agent will wait for the execution of the module.'), true);
|
||||
|
||||
|
||||
$table->data['edit16'][0] = __('Retries');
|
||||
$table->data['edit16'][1] = html_print_input_text ('max_retries', '', '', 5, 10, true) . ' ' .
|
||||
ui_print_help_tip (
|
||||
__('Number of retries that the module will attempt to run.'), true);
|
||||
|
||||
|
||||
$table->data['edit22'][0] = __('Web checks').ui_print_help_icon ("web_checks", true);;
|
||||
$table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter" cols="65" rows="15"></textarea>';
|
||||
|
||||
|
||||
$table->data['edit22'][0] = __('Web checks').ui_print_help_icon ("web_checks", true);;
|
||||
$table->data['edit22'][1] = '<textarea id="textarea_plugin_parameter" name="plugin_parameter" cols="65" rows="15"></textarea>';
|
||||
|
||||
$table->data['edit16'][2] = __('Port');
|
||||
$table->data['edit16'][3] = html_print_input_text ('tcp_port', '', '', 5, 20, true);
|
||||
|
||||
|
@ -1491,7 +1493,7 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
|||
$values['custom_string_2'] = io_input_password($snmp3_privacy_pass);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$throw_unknown_events = get_parameter('throw_unknown_events', '');
|
||||
if ($throw_unknown_events !== '') {
|
||||
//Set the event type that can show.
|
||||
|
@ -1499,24 +1501,23 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu
|
|||
EVENTS_GOING_UNKNOWN => (int)$throw_unknown_events);
|
||||
$values['disabled_types_event'] = json_encode($disabled_types_event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (strlen(get_parameter('history_data')) > 0) {
|
||||
$values['history_data'] = get_parameter('history_data');
|
||||
}
|
||||
|
||||
|
||||
if (get_parameter('quiet_select', -1) != -1) {
|
||||
$values['quiet'] = get_parameter('quiet_select');
|
||||
}
|
||||
|
||||
|
||||
$filter_modules = false;
|
||||
|
||||
|
||||
if (!is_numeric($module_name) or ($module_name != 0))
|
||||
$filter_modules['nombre'] = $module_name;
|
||||
|
||||
|
||||
// Whether to update module tag info
|
||||
$update_tags = get_parameter('id_tag', false);
|
||||
|
||||
|
||||
if (array_search(0, $agents_select) !== false) {
|
||||
//Apply at All agents.
|
||||
$modules = db_get_all_rows_filter ('tagente_modulo',
|
||||
|
|
|
@ -10368,7 +10368,9 @@ 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'));
|
||||
return;
|
||||
|
@ -10411,12 +10413,22 @@ function api_set_create_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
if(empty($id_critical_module_sla)){
|
||||
$id_critical_module_sla = 0;
|
||||
}
|
||||
|
||||
$result = services_create_service ($name, $description, $id_group,
|
||||
$critical, $warning, SECONDS_5MINUTES, $mode, $id_agent, $sla_interval, $sla_limit,
|
||||
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,
|
||||
$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));
|
||||
} else {
|
||||
|
@ -10485,9 +10497,9 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
if(empty($warning)){
|
||||
$warning = $service['warning'];
|
||||
}
|
||||
|
||||
|
||||
$mode = 0;
|
||||
|
||||
|
||||
$id_agent = $other['data'][5];
|
||||
if(empty($id_agent)){
|
||||
$id_agent = $service['id_agent_module'];
|
||||
|
@ -10512,25 +10524,40 @@ function api_set_update_service($thrash1, $thrash2, $other, $thrash3) {
|
|||
if(empty($id_critical_module_template)){
|
||||
$id_critical_module_template = $service['id_template_alert_critical'];
|
||||
}
|
||||
|
||||
|
||||
$id_unknown_module_template = 0;
|
||||
|
||||
|
||||
$id_critical_module_sla = $other['data'][10];
|
||||
if(empty($id_critical_module_sla)){
|
||||
$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'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,6 +87,7 @@ CREATE TABLE IF NOT EXISTS `tagente` (
|
|||
`transactional_agent` tinyint(1) NOT NULL default '0',
|
||||
`alias_as_name` tinyint(2) NOT NULL default '0',
|
||||
`safe_mode_module` int(10) unsigned NOT NULL default '0',
|
||||
`cps` int NOT NULL default 0,
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`(255)),
|
||||
KEY `direccion` (`direccion`),
|
||||
|
@ -259,6 +260,7 @@ CREATE TABLE IF NOT EXISTS `tagente_modulo` (
|
|||
`prediction_samples` int(4) default 0,
|
||||
`prediction_threshold` int(4) default 0,
|
||||
`parent_module_id` int(10) unsigned NOT NULL,
|
||||
`cps` int NOT NULL default 0,
|
||||
PRIMARY KEY (`id_agente_modulo`),
|
||||
KEY `main_idx` (`id_agente_modulo`,`id_agente`),
|
||||
KEY `tam_agente` (`id_agente`),
|
||||
|
@ -2424,6 +2426,9 @@ CREATE TABLE IF NOT EXISTS `tservice` (
|
|||
`id_template_alert_critical` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_unknown` int(10) unsigned NOT NULL default 0,
|
||||
`id_template_alert_critical_sla` int(10) unsigned NOT NULL default 0,
|
||||
`quiet` tinyint(1) NOT NULL default 0,
|
||||
`cps` int NOT NULL default 0,
|
||||
`cascade_protection` tinyint(1) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB
|
||||
COMMENT = 'Table to define services to monitor'
|
||||
|
@ -3005,6 +3010,7 @@ CREATE TABLE IF NOT EXISTS `tmetaconsole_agent` (
|
|||
`alias` varchar(600) BINARY NOT NULL default '',
|
||||
`alias_as_name` tinyint(2) NOT NULL default '0',
|
||||
`safe_mode_module` int(10) unsigned NOT NULL default '0',
|
||||
`cps` int NOT NULL default 0,
|
||||
PRIMARY KEY (`id_agente`),
|
||||
KEY `nombre` (`nombre`(255)),
|
||||
KEY `direccion` (`direccion`),
|
||||
|
|
|
@ -109,7 +109,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||
('custom_report_front_header', ''),
|
||||
('custom_report_front_footer', ''),
|
||||
('MR', 17),
|
||||
('MR', 18),
|
||||
('identification_reminder', 1),
|
||||
('identification_reminder_timestamp', 0),
|
||||
('current_package_enterprise', '724'),
|
||||
|
|
|
@ -330,7 +330,7 @@ sub pandora_generate_alerts ($$$$$$$$;$$$) {
|
|||
if ($EventStormProtection == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Warmup interval for alerts.
|
||||
if ($pa_config->{'warmup_alert_on'} == 1) {
|
||||
|
||||
|
@ -344,20 +344,29 @@ sub pandora_generate_alerts ($$$$$$$$;$$$) {
|
|||
|
||||
if ($agent->{'quiet'} == 1) {
|
||||
logger($pa_config, "Generate Alert. The agent '" . $agent->{'nombre'} . "' is in quiet mode.", 10);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($module->{'quiet'} == 1) {
|
||||
logger($pa_config, "Generate Alert. The module '" . $module->{'nombre'} . "' is in quiet mode.", 10);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($agent->{'cps'} > 0) {
|
||||
logger($pa_config, "Generate Alert. The agent '" . $agent->{'nombre'} . "' is in quiet mode by cascade protection services.", 10);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($module->{'cps'} > 0) {
|
||||
logger($pa_config, "Generate Alert. The module '" . $module->{'nombre'} . "' is in quiet mode by cascade protection services.", 10);
|
||||
return;
|
||||
}
|
||||
|
||||
# Do not generate alerts for disabled groups
|
||||
if (is_group_disabled ($dbh, $agent->{'id_grupo'})) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Get enabled alerts associated with this module
|
||||
my $alert_type_filter = defined ($alert_type) ? " AND type = '$alert_type'" : '';
|
||||
my @alerts = get_db_rows ($dbh, '
|
||||
|
@ -367,11 +376,11 @@ sub pandora_generate_alerts ($$$$$$$$;$$$) {
|
|||
WHERE talert_template_modules.id_alert_template = talert_templates.id
|
||||
AND id_agent_module = ?
|
||||
AND disabled = 0' . $alert_type_filter, $module->{'id_agente_modulo'});
|
||||
|
||||
|
||||
foreach my $alert (@alerts) {
|
||||
my $rc = pandora_evaluate_alert($pa_config, $agent, $data,
|
||||
$status, $alert, $utimestamp, $dbh, $last_data_value);
|
||||
|
||||
|
||||
pandora_process_alert ($pa_config, $data, $agent, $module,
|
||||
$alert, $rc, $dbh, $timestamp, $extra_macros);
|
||||
}
|
||||
|
@ -3131,8 +3140,13 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
|||
logger($pa_config, "Generate Event. The agent '" . $agent->{'nombre'} . "' is in quiet mode.", 10);
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined ($agent) && $agent->{'cps'} > 0) {
|
||||
logger($pa_config, "Generate Event. The agent '" . $agent->{'nombre'} . "' is in quiet mode by cascade protection services.", 10);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $module = undef;
|
||||
if (defined($id_agentmodule) && $id_agentmodule != 0) {
|
||||
$module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = ?', $id_agentmodule);
|
||||
|
@ -3140,8 +3154,13 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
|||
logger($pa_config, "Generate Event. The module '" . $module->{'nombre'} . "' is in quiet mode.", 10);
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined ($module) && $module->{'cps'} > 0) {
|
||||
logger($pa_config, "Generate Event. The module '" . $module->{'nombre'} . "' is in quiet mode by cascade protection services.", 10);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Get module tags
|
||||
my $module_tags = '';
|
||||
if (defined ($tags) && ($tags ne '')) {
|
||||
|
@ -3152,8 +3171,8 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
|||
$module_tags = pandora_get_module_tags ($pa_config, $dbh, $id_agentmodule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# Set default values for optional parameters
|
||||
$source = 'monitoring_server' unless defined ($source);
|
||||
$comment = '' unless defined ($comment);
|
||||
|
|
Loading…
Reference in New Issue