Fixed bugs in metaconsole reports

This commit is contained in:
manuel 2019-10-01 12:46:09 +02:00
parent d566da6fb1
commit 454750aefe
3 changed files with 26 additions and 9 deletions

View File

@ -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 [];
}

View File

@ -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;
}
}
}
}

View File

@ -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':