From 17b726d7a079168334f16d7293750894bf8160bf Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 21 Jun 2018 14:15:27 +0200 Subject: [PATCH 1/8] changes bd for mr, schema and migrate and update tocken mr --- pandora_console/extras/mr/18.sql | 13 +++++++++++++ .../extras/pandoradb_migrate_6.0_to_7.0.mysql.sql | 15 +++++++++++++-- pandora_console/pandoradb.sql | 6 ++++++ pandora_console/pandoradb_data.sql | 2 +- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 pandora_console/extras/mr/18.sql diff --git a/pandora_console/extras/mr/18.sql b/pandora_console/extras/mr/18.sql new file mode 100644 index 0000000000..b7e4be33e0 --- /dev/null +++ b/pandora_console/extras/mr/18.sql @@ -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; \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index 91e0dc5e65..6752754a5c 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -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; -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index ddf1775095..80db61c37b 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -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`), diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 1df91d121d..15259e8f7f 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -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'), From 92fbc86ed9c5836e4d2eee526b3cdc0875c6fa1b Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 22 Jun 2018 14:59:17 +0200 Subject: [PATCH 2/8] add cascade protection in services --- pandora_console/include/functions_api.php | 61 ++++++++++++++++------- 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 6fc06a8751..a928f6e429 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -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')); } - } /** From 1ca35be41e80738c02cd36671582cb2a406d4b8c Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 25 Jun 2018 15:05:07 +0200 Subject: [PATCH 3/8] fixed error ingraph bool zoom --- pandora_console/include/functions_graph.php | 40 +++++++++++++++------ 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 812e729502..40e5a2b658 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -271,17 +271,35 @@ function grafico_modulo_sparse_data_chart ( ); } else{ - $data = db_get_all_rows_filter ( - 'tagente_datos', - array ('id_agente_modulo' => (int)$agent_module_id, - "utimestamp > '". $date_array['start_date']. "'", - "utimestamp < '". $date_array['final_date'] . "'", - 'group' => "ROUND(utimestamp / $data_slice)", - 'order' => 'utimestamp ASC'), - array ('sum(datos)/count(datos) as datos', 'min(utimestamp) as utimestamp'), - 'AND', - $data_module_graph['history_db'] - ); + if($data_module_graph['id_module_type'] == 2 || + $data_module_graph['id_module_type'] == 6 || + $data_module_graph['id_module_type'] == 18 || + $data_module_graph['id_module_type'] == 9){ + $data = db_get_all_rows_filter ( + 'tagente_datos', + array ('id_agente_modulo' => (int)$agent_module_id, + "utimestamp > '". $date_array['start_date']. "'", + "utimestamp < '". $date_array['final_date'] . "'", + 'group' => "ROUND(utimestamp / $data_slice)", + 'order' => 'utimestamp ASC'), + array ('ROUND(sum(datos)/count(datos)) as datos', 'min(utimestamp) as utimestamp'), + 'AND', + $data_module_graph['history_db'] + ); + } + else{ + $data = db_get_all_rows_filter ( + 'tagente_datos', + array ('id_agente_modulo' => (int)$agent_module_id, + "utimestamp > '". $date_array['start_date']. "'", + "utimestamp < '". $date_array['final_date'] . "'", + 'group' => "ROUND(utimestamp / $data_slice)", + 'order' => 'utimestamp ASC'), + array ('sum(datos)/count(datos) as datos', 'min(utimestamp) as utimestamp'), + 'AND', + $data_module_graph['history_db'] + ); + } } } From 36293cba3af7db1bd9355e6de0f596cc37623bdb Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 25 Jun 2018 15:07:12 +0200 Subject: [PATCH 4/8] Revert "fixed error ingraph bool zoom" This reverts commit 1ca35be41e80738c02cd36671582cb2a406d4b8c. --- pandora_console/include/functions_graph.php | 40 ++++++--------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 40e5a2b658..812e729502 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -271,35 +271,17 @@ function grafico_modulo_sparse_data_chart ( ); } else{ - if($data_module_graph['id_module_type'] == 2 || - $data_module_graph['id_module_type'] == 6 || - $data_module_graph['id_module_type'] == 18 || - $data_module_graph['id_module_type'] == 9){ - $data = db_get_all_rows_filter ( - 'tagente_datos', - array ('id_agente_modulo' => (int)$agent_module_id, - "utimestamp > '". $date_array['start_date']. "'", - "utimestamp < '". $date_array['final_date'] . "'", - 'group' => "ROUND(utimestamp / $data_slice)", - 'order' => 'utimestamp ASC'), - array ('ROUND(sum(datos)/count(datos)) as datos', 'min(utimestamp) as utimestamp'), - 'AND', - $data_module_graph['history_db'] - ); - } - else{ - $data = db_get_all_rows_filter ( - 'tagente_datos', - array ('id_agente_modulo' => (int)$agent_module_id, - "utimestamp > '". $date_array['start_date']. "'", - "utimestamp < '". $date_array['final_date'] . "'", - 'group' => "ROUND(utimestamp / $data_slice)", - 'order' => 'utimestamp ASC'), - array ('sum(datos)/count(datos) as datos', 'min(utimestamp) as utimestamp'), - 'AND', - $data_module_graph['history_db'] - ); - } + $data = db_get_all_rows_filter ( + 'tagente_datos', + array ('id_agente_modulo' => (int)$agent_module_id, + "utimestamp > '". $date_array['start_date']. "'", + "utimestamp < '". $date_array['final_date'] . "'", + 'group' => "ROUND(utimestamp / $data_slice)", + 'order' => 'utimestamp ASC'), + array ('sum(datos)/count(datos) as datos', 'min(utimestamp) as utimestamp'), + 'AND', + $data_module_graph['history_db'] + ); } } From ff934e28faec1691c5550883e1ebf53a58dd91b3 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 25 Jun 2018 15:09:01 +0200 Subject: [PATCH 5/8] fixed minor error --- pandora_console/pandoradb.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 80db61c37b..5b77263b6a 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -2428,7 +2428,7 @@ CREATE TABLE IF NOT EXISTS `tservice` ( `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 + `cascade_protection` tinyint(1) NOT NULL default 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB COMMENT = 'Table to define services to monitor' From 76cd718262af86be3671e2170f9fe75437f60fb6 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 26 Jun 2018 13:23:12 +0200 Subject: [PATCH 6/8] add cps for agent, module, policies and bulk opertaion --- .../godmode/agentes/agent_manager.php | 17 ++- .../godmode/agentes/configurar_agente.php | 117 ++++++++++-------- .../godmode/agentes/module_manager_editor.php | 2 + .../agentes/module_manager_editor_common.php | 19 ++- .../godmode/massive/massive_edit_agents.php | 16 +++ .../godmode/massive/massive_edit_modules.php | 52 +++++--- 6 files changed, 147 insertions(+), 76 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 791f09d2ab..176551decb 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -515,9 +515,20 @@ $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_array[0] = __('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); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 02fa58e597..98901feaaf 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -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,12 @@ 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); + $fields = db_get_all_fields_in_table('tagent_custom_fields'); - + if ($fields === false) $fields = array(); - + $field_values = array(); foreach ($fields as $field) { @@ -216,8 +219,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 +240,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 +261,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,8 +290,9 @@ 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.'"}'; + $unsafe_alias = io_safe_output($alias); db_pandora_audit("Agent management", "Created agent $unsafe_alias", false, true, $info); @@ -743,6 +752,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'); @@ -794,47 +804,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')); @@ -868,7 +880,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)); @@ -879,7 +891,7 @@ if ($update_agent) { // if modified some agent paramenter } } } - + $info = '{ "id_agente":"' . $id_agente . '", "alias":"' . $alias . '", @@ -897,8 +909,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", @@ -918,14 +931,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)){ @@ -951,6 +964,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; } @@ -967,7 +981,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")) { @@ -1001,6 +1015,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'); @@ -1318,6 +1333,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, @@ -1362,8 +1378,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) && @@ -1500,6 +1516,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, diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 4efa2767ba..ae5b405519 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -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']; @@ -302,6 +303,7 @@ else { $max = ''; $interval = ''; $quiet_module = 0; + $cps_module = 0; $unit = ''; $prediction_module = ''; $custom_integer_1 = 0; diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 040ad8a307..7c09f2ead4 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -566,11 +566,20 @@ 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 > 0){ + $cps_array[$cps_module] = __('Enabled'); +} +else{ + $cps_array[0] = __('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); diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 849101f169..26a6aff734 100755 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -82,6 +82,8 @@ if ($update_agents) { $values['delete_conf'] = get_parameter('delete_conf'); if (get_parameter('quiet_select', -1) != -1) $values['quiet'] = get_parameter('quiet_select'); + if (get_parameter('cps_select', -2) != -2) + $values['cps'] = get_parameter('cps_select'); $fields = db_get_all_fields_in_table('tagent_custom_fields'); @@ -392,6 +394,7 @@ $update_gis_data = -1; $cascade_protection = -1; $cascade_protection_module = -1; $quiet_select = -1; +$cps_select = -2; $table = new StdClass(); $table->width = '100%'; @@ -479,6 +482,19 @@ $table->data[6][1] = html_print_select(array(-1 => __('No change'), 1 => __('Yes'), 0 => __('No')), "quiet_select", $quiet_select, "", '', 0, true); +$cps_array[-2] = __('No change'); +$cps_array[-1] = __('Disabled'); +if($cps > 0){ + $cps_array[$cps_select] = __('Enabled'); +} +else{ + $cps_array[0] = __('Enabled'); +} + +$table->data[7][0] = __('Cascade Protection Service'); +$table->data[7][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true); +$table->data[7][1] = html_print_select($cps_array, "cps_select", $cps_select, "", '', 0, true); + ui_toggle(html_print_table ($table, true), __('Advanced options')); unset($table); diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index a7c8626fce..dfb601545d 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -635,21 +635,34 @@ $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( + +$cps_array[-2] = __('No change'); +$cps_array[-1] = __('Disabled'); +if($cps > 0){ + $cps_array[$cps_select] = __('Enabled'); +} +else{ + $cps_array[0] = __('Enabled'); +} + +$table->data['edit11'][2] = __('Cascade Protection Service'); +$table->data['edit11'][2] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true); +$table->data['edit11'][3] .= html_print_select($cps_array, "cps_select", -1, "", '', 0, true); + +$table->data['edit16'][0] = __('Timeout'); +$table->data['edit16'][1] .= 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) . ' ' . + +$table->data['edit16'][1] .= __('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] = ''; - + +$table->data['edit22'][0] = __('Web checks').ui_print_help_icon ("web_checks", true);; +$table->data['edit22'][1] = ''; + $table->data['edit16'][2] = __('Port'); $table->data['edit16'][3] = html_print_input_text ('tcp_port', '', '', 5, 20, true); @@ -1491,7 +1504,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 +1512,27 @@ 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'); } - + + if (get_parameter('cps_select', -2) != -2) { + $values['cps'] = get_parameter('cps_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', From 85897315cd12d5a92694fb1a0f04522b1d7e02a7 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 27 Jun 2018 15:03:46 +0200 Subject: [PATCH 7/8] cascade protection services --- .../godmode/agentes/agent_manager.php | 6 ++++- .../godmode/agentes/module_manager_editor.php | 4 ++-- .../agentes/module_manager_editor_common.php | 8 +++++-- .../godmode/massive/massive_edit_agents.php | 18 +-------------- .../godmode/massive/massive_edit_modules.php | 23 ++++--------------- 5 files changed, 18 insertions(+), 41 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index fae6bdb27e..5879790d57 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -523,7 +523,11 @@ if($cps > 0){ $cps_array[$cps] = __('Enabled'); } else{ - $cps_array[0] = __('Enabled'); + $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'); diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index ae5b405519..1bf189c660 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -290,7 +290,7 @@ if ($id_agent_module) { else { if (!isset ($moduletype)) { $moduletype = (string) get_parameter ('moduletype'); - + // Clean up specific network modules fields $name = ''; $description = ''; @@ -316,7 +316,7 @@ else { $tcp_send = ''; $tcp_rcv = ''; $tcp_port = ''; - + if ($moduletype == "wmiserver") $snmp_community = ''; else diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 7c09f2ead4..db77af000b 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -570,11 +570,15 @@ $table_advanced->data[7][0] .= ui_print_help_tip(__('The module still stores dat $table_advanced->data[7][1] = html_print_checkbox('quiet_module', 1, $quiet_module, true, $disabledBecauseInPolicy); $cps_array[-1] = __('Disabled'); -if($cps > 0){ +if($cps_module > 0){ $cps_array[$cps_module] = __('Enabled'); } else{ - $cps_array[0] = __('Enabled'); + $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); diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php index 26a6aff734..f543772648 100755 --- a/pandora_console/godmode/massive/massive_edit_agents.php +++ b/pandora_console/godmode/massive/massive_edit_agents.php @@ -82,9 +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'); - if (get_parameter('cps_select', -2) != -2) - $values['cps'] = get_parameter('cps_select'); - + $fields = db_get_all_fields_in_table('tagent_custom_fields'); if ($fields === false) $fields = array(); @@ -394,7 +392,6 @@ $update_gis_data = -1; $cascade_protection = -1; $cascade_protection_module = -1; $quiet_select = -1; -$cps_select = -2; $table = new StdClass(); $table->width = '100%'; @@ -482,19 +479,6 @@ $table->data[6][1] = html_print_select(array(-1 => __('No change'), 1 => __('Yes'), 0 => __('No')), "quiet_select", $quiet_select, "", '', 0, true); -$cps_array[-2] = __('No change'); -$cps_array[-1] = __('Disabled'); -if($cps > 0){ - $cps_array[$cps_select] = __('Enabled'); -} -else{ - $cps_array[0] = __('Enabled'); -} - -$table->data[7][0] = __('Cascade Protection Service'); -$table->data[7][0] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true); -$table->data[7][1] = html_print_select($cps_array, "cps_select", $cps_select, "", '', 0, true); - ui_toggle(html_print_table ($table, true), __('Advanced options')); unset($table); diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index dfb601545d..87fb1b3173 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -636,27 +636,16 @@ $table->data['edit11'][1] = html_print_select(array(-1 => __('No change'), 1 => __('Yes'), 0 => __('No')), "quiet_select", -1, "", '', 0, true); -$cps_array[-2] = __('No change'); -$cps_array[-1] = __('Disabled'); -if($cps > 0){ - $cps_array[$cps_select] = __('Enabled'); -} -else{ - $cps_array[0] = __('Enabled'); -} -$table->data['edit11'][2] = __('Cascade Protection Service'); -$table->data['edit11'][2] .= ui_print_help_tip(__('Disable the alerts and events of the elements that belong to this service'), true); -$table->data['edit11'][3] .= html_print_select($cps_array, "cps_select", -1, "", '', 0, true); -$table->data['edit16'][0] = __('Timeout'); -$table->data['edit16'][1] .= html_print_input_text( +$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'][1] .= __('Retries'); -$table->data['edit16'][1] .= html_print_input_text ('max_retries', '', '', 5, 10, 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); @@ -1521,10 +1510,6 @@ function process_manage_edit ($module_name, $agents_select = null, $module_statu $values['quiet'] = get_parameter('quiet_select'); } - if (get_parameter('cps_select', -2) != -2) { - $values['cps'] = get_parameter('cps_select'); - } - $filter_modules = false; if (!is_numeric($module_name) or ($module_name != 0)) From 8ae27da3b79501f4ff93f60967e7f65cd0886c66 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 27 Jun 2018 15:39:13 +0200 Subject: [PATCH 8/8] add cascade protection services in server --- pandora_server/lib/PandoraFMS/Core.pm | 41 ++++++++++++++++++++------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 4d993de8ff..12ac711da5 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -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);