From 00733bdf42525f99f66052643735cbac0112962a Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 30 Jul 2013 14:10:05 +0000 Subject: [PATCH] 2013-07-30 Miguel de Dios * extensions/update_manager/lib/functions.ajax.php, godmode/agentes/configurar_agente.php, include/functions_html.php, include/functions_networkmap.php: cleaned source code and removed the debug traces. * godmode/agentes/module_manager_editor_prediction.php, include/constants.php: fixed the repeat operator and added some constants for to make more easy the code. Fixes: #2279 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8597 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 ++++++++ .../update_manager/lib/functions.ajax.php | 2 +- .../godmode/agentes/configurar_agente.php | 3 ++- .../module_manager_editor_prediction.php | 25 +++++++++++++----- pandora_console/include/constants.php | 5 ++++ pandora_console/include/functions_html.php | 26 ++++++++++--------- .../include/functions_networkmap.php | 7 ++--- 7 files changed, 53 insertions(+), 26 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5e2c94394e..ecec6db9c8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2013-07-30 Miguel de Dios + + * extensions/update_manager/lib/functions.ajax.php, + godmode/agentes/configurar_agente.php + + +godmode/agentes/module_manager_editor_prediction.php +include/functions_html.php +include/constants.php +include/functions_networkmap.php + 2013-07-30 Miguel de Dios * mobile/operation/networkmap.php, godmode/users/user_list.php, diff --git a/pandora_console/extensions/update_manager/lib/functions.ajax.php b/pandora_console/extensions/update_manager/lib/functions.ajax.php index 79c0d7bf99..d21be4d83e 100644 --- a/pandora_console/extensions/update_manager/lib/functions.ajax.php +++ b/pandora_console/extensions/update_manager/lib/functions.ajax.php @@ -402,7 +402,7 @@ function update_pandora_install_package() { // bsdtar use stderr for verbose output if ($tar_type === 'BSD') $command .= ' 2>&1'; - + print_debug_message_trace($command); //html_debug_print($command, true); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 966f9ac57b..4fb89f2c87 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -984,7 +984,8 @@ if ($update_module) { } else { if ($prediction_module == 3) { - enterprise_hook('modules_create_synthetic_operations', array($id_agent_module, $serialize_ops)); + enterprise_hook('modules_create_synthetic_operations', + array($id_agent_module, $serialize_ops)); } // Update the module interval diff --git a/pandora_console/godmode/agentes/module_manager_editor_prediction.php b/pandora_console/godmode/agentes/module_manager_editor_prediction.php index a34d0c55c8..82376fbb30 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_prediction.php +++ b/pandora_console/godmode/agentes/module_manager_editor_prediction.php @@ -38,16 +38,26 @@ if ($row !== false && is_array($row)) { // Services are an Enterprise feature. $custom_integer_1 = $row['custom_integer_1']; - switch($prediction_module) { - case 2: + switch ($prediction_module) { + case MODULE_PREDICTION_SERVICE: $is_service = true; $custom_integer_2 = 0; break; - case 3: - $ops_json = enterprise_hook('modules_get_synthetic_operations', array($id_agente_modulo)); + case MODULE_PREDICTION_SYNTHETIC: + $ops_json = enterprise_hook('modules_get_synthetic_operations', + array($id_agente_modulo)); + + $ops = json_decode($ops_json, true); - $first_op = explode('_', reset(array_keys($ops))); + + + //Erase the key of array serialize as ** + $chunks = explode('**', reset(array_keys($ops))); + + $first_op = explode('_', $chunks[1]); + + if (isset($first_op[1]) && $first_op[1] == 'avg') { $is_synthetic_avg = true; @@ -59,7 +69,7 @@ if ($row !== false && is_array($row)) { $custom_integer_1 = 0; $custom_integer_2 = 0; break; - case 4: + case MODULE_PREDICTION_NETFLOW: $is_netflow = true; $custom_integer_2 = 0; break; @@ -189,9 +199,10 @@ if ($netflow_module_form !== ENTERPRISE_NOT_HOOK) { } + + /* Removed common useless parameter */ unset ($table_advanced->data[3]); - ?>