From 16cff75242dd8538bd84a9ac6662758b89883d42 Mon Sep 17 00:00:00 2001 From: fermin831 Date: Fri, 22 Jun 2018 13:29:36 +0200 Subject: [PATCH] Revert "Recover critical status the SNMPTrap on SNMP console actions" This reverts commit 8ef8f31f67278c4ee0c2bfd7879e60ac7ade794a. --- pandora_console/include/functions_modules.php | 18 ------------------ .../operation/snmpconsole/snmp_view.php | 17 +++++------------ 2 files changed, 5 insertions(+), 30 deletions(-) diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index a0979e4887..0d1c208e16 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -2741,22 +2741,4 @@ function get_module_realtime_link_graph ($module) { return $link_button; } - -/** - * @brief Force a module to adopt a determinated status. - * WARNING: Only use this function to modules that changes their status - * with some user action through the console - * @param int New status - * @param int Agent module to force new status - */ -function force_set_module_status ($status, $id_agent_module) { - return db_process_sql_update( 'tagente_estado', - array( - 'estado' => $status, - 'known_status' => $status, - 'last_known_status' => $status - ), - array('id_agente_modulo' => $id_agent_module) - ); -} ?> diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 25dfd563ab..917cd8eee7 100755 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -18,7 +18,6 @@ // Load global vars global $config; enterprise_include ("operation/snmpconsole/snmp_view.php"); -enterprise_include ("include/functions_snmp.php"); require_once("include/functions_agents.php"); require_once("include/functions_snmp.php"); @@ -98,19 +97,18 @@ else { if (isset ($_GET["delete"])) { $id_trap = (int) get_parameter_get ("delete", 0); if ($id_trap > 0 && check_acl ($config['id_user'], 0, "IM")) { + if($group_by){ - $sql_ids_traps = "SELECT id_trap, source FROM ttrap WHERE oid IN (SELECT oid FROM ttrap WHERE id_trap = ".$id_trap.") + $sql_ids_traps = "SELECT id_trap FROM ttrap WHERE oid IN (SELECT oid FROM ttrap WHERE id_trap = ".$id_trap.") AND source IN (SELECT source FROM ttrap WHERE id_trap = ".$id_trap.")"; $ids_traps = db_get_all_rows_sql($sql_ids_traps); foreach ($ids_traps as $key => $value) { $result = db_process_sql_delete('ttrap', array('id_trap' => $value['id_trap'])); - enterprise_hook('snmp_update_forwarded_modules', array($value)); } + } else { - $forward_info = db_get_row('ttrap', 'id_trap', $id_trap); $result = db_process_sql_delete('ttrap', array('id_trap' => $id_trap)); - enterprise_hook('snmp_update_forwarded_modules', array($forward_info)); ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); @@ -131,8 +129,7 @@ if (isset ($_GET["check"])) { 'status' => 1, 'id_usuario' => $config["id_user"]); $result = db_process_sql_update('ttrap', $values, array('id_trap' => $id_trap)); - enterprise_hook('snmp_update_forwarded_modules', array($id_trap)); - + ui_print_result_message ($result, __('Successfully updated'), __('Could not be updated')); @@ -149,20 +146,17 @@ if (isset ($_POST["deletebt"])) { if (is_array ($trap_ids) && check_acl ($config['id_user'], 0, "IW")) { if($group_by){ foreach ($trap_ids as $key => $value) { - $sql_ids_traps = "SELECT id_trap, source FROM ttrap WHERE oid IN (SELECT oid FROM ttrap WHERE id_trap = ".$value.") + $sql_ids_traps = "SELECT id_trap FROM ttrap WHERE oid IN (SELECT oid FROM ttrap WHERE id_trap = ".$value.") AND source IN (SELECT source FROM ttrap WHERE id_trap = ".$value.")"; $ids_traps = db_get_all_rows_sql($sql_ids_traps); foreach ($ids_traps as $key2 => $value2) { $result = db_process_sql_delete('ttrap', array('id_trap' => $value2['id_trap'])); - enterprise_hook('snmp_update_forwarded_modules', array($value2)); } } } else { foreach ($trap_ids as $id_trap) { - $forward_info = db_get_row('ttrap', 'id_trap', $id_trap); db_process_sql_delete('ttrap', array('id_trap' => $id_trap)); - enterprise_hook('snmp_update_forwarded_modules', array($forward_info)); } } } @@ -179,7 +173,6 @@ if (isset ($_POST["updatebt"])) { foreach ($trap_ids as $id_trap) { $sql = sprintf ("UPDATE ttrap SET status = 1, id_usuario = '%s' WHERE id_trap = %d", $config["id_user"], $id_trap); db_process_sql ($sql); - enterprise_hook('snmp_update_forwarded_modules', array($id_trap)); } } else {