From d566da6fb1a5ef076a589ad91ca692b6710b24e3 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 30 Sep 2019 15:33:44 +0200 Subject: [PATCH 1/2] Fixed bug in meta serialize data --- pandora_console/include/functions_reporting_html.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index a15340ce4b..c91ce836ec 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2207,12 +2207,15 @@ function reporting_html_database_serialized($table, $item, $pdf=0) { $table1 = new stdClass(); $table1->width = '100%'; - $table1->head = [__('Date')]; + $table1->head = [ + __('Date'), + __('Data'), + ]; if (!empty($item['keys'])) { $table1->head = array_merge($table1->head, $item['keys']); } - $table1->style[0] = 'text-align: left'; + $table1->style[0] = 'text-align: center'; $table1->data = []; foreach ($item['data'] as $data) { From 454750aefe8eb957cf0f0cd362331bfabece179e Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 1 Oct 2019 12:46:09 +0200 Subject: [PATCH 2/2] Fixed bugs in metaconsole reports --- .../include/functions_custom_graphs.php | 20 ++++++++++++++++++- .../include/functions_reporting.php | 10 ++++++---- .../include/functions_reporting_html.php | 5 +---- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index 4a1c5df11c..45341efbb3 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -124,8 +124,26 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t } $groups = users_get_groups($id_user, $privileges, $returnAllGroup); + $all_graphs = []; + if (is_metaconsole()) { + $servers = metaconsole_get_connection_names(); + foreach ($servers as $key => $server) { + $connection = metaconsole_get_connection($server); + if (metaconsole_connect($connection) != NOERR) { + continue; + } + + $all_graph = db_get_all_rows_in_table('tgraph', 'name'); + if ($all_graph !== false) { + $all_graphs = array_merge($all_graphs, $all_graph); + } + + metaconsole_restore_db(); + } + } else { + $all_graphs = db_get_all_rows_in_table('tgraph', 'name'); + } - $all_graphs = db_get_all_rows_in_table('tgraph', 'name'); if ($all_graphs === false) { return []; } diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 4edd0ef642..eaffd75f58 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -7488,10 +7488,12 @@ function reporting_custom_graph( if ($type_report == 'custom_graph') { if (is_metaconsole()) { - $id_meta = metaconsole_get_id_server($content['server_name']); - $server = metaconsole_get_connection_by_id($id_meta); - if (metaconsole_connect($server) != NOERR) { - return false; + $servers = metaconsole_get_connection_names(); + foreach ($servers as $server) { + $connection = metaconsole_get_connection($server); + if (metaconsole_connect($connection) != NOERR) { + continue; + } } } } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index c91ce836ec..1116b427c6 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -251,6 +251,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) reporting_html_sql($table, $item); break; + case 'simple_baseline_graph': case 'simple_graph': reporting_html_graph($table, $item); break; @@ -315,10 +316,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) reporting_html_prediction_date($table, $item, $mini); break; - case 'simple_baseline_graph': - reporting_html_graph($table, $item); - break; - case 'netflow_area': case 'netflow_data': case 'netflow_summary':