From 2c019f04ee2af72a61bfa3ea40d72752f45c4368 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Wed, 8 Jan 2020 11:37:44 +0100 Subject: [PATCH] Fixed bug in auto combined graph --- pandora_console/include/functions_graph.php | 17 ++++++++-- .../include/functions_reporting.php | 31 +++++++++++++------ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index e98fd2a319..42f848b649 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1446,9 +1446,20 @@ function graphic_combined_module( $data_module_graph['agent_name'] = modules_get_agentmodule_agent_name( $agent_module_id ); - $data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias( - $agent_module_id - ); + + if (is_metaconsole()) { + $data_module_graph['agent_alias'] = db_get_value( + 'alias', + 'tagente', + 'id_agente', + (int) $module_data['id_agente'] + ); + } else { + $data_module_graph['agent_alias'] = modules_get_agentmodule_agent_alias( + $agent_module_id + ); + } + $data_module_graph['agent_id'] = $module_data['id_agente']; $data_module_graph['module_name'] = $module_data['nombre']; $data_module_graph['id_module_type'] = $module_data['id_tipo_modulo']; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index d774e51e81..7bffd6087d 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -325,6 +325,17 @@ function reporting_make_reporting_data( $content['id_agent'] ); + // This is for metaconsole. It is an array with modules and server (id node). + if (is_array($content['id_agent_module'])) { + $modules_server_array = $content['id_agent_module']; + $modules_array = []; + foreach ($modules_server_array as $value) { + $modules_array[] = $value['module']; + } + + $content['id_agent_module'] = $modules_array; + } + $modules = agents_get_modules( $agent_value, [ @@ -7599,16 +7610,18 @@ function reporting_custom_graph( $content['name'] = __('Simple graph'); } - $module_source = db_get_all_rows_sql( - 'SELECT id_agent_module - FROM tgraph_source - WHERE id_graph = '.$content['id_gs'] - ); + if ($type_report != 'automatic_graph') { + $module_source = db_get_all_rows_sql( + 'SELECT id_agent_module + FROM tgraph_source + WHERE id_graph = '.$content['id_gs'] + ); - if (isset($module_source) && is_array($module_source)) { - $modules = []; - foreach ($module_source as $key => $value) { - $modules[$key] = $value['id_agent_module']; + if (isset($module_source) && is_array($module_source)) { + $modules = []; + foreach ($module_source as $key => $value) { + $modules[$key] = $value['id_agent_module']; + } } }