diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 1d2558f147..867bb4c36c 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -6353,7 +6353,17 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', } } else{ - $modules[] = $content['id_agent_module']; + if ($content['id_agent_module']) { + $modules[] = $content['id_agent_module']; + } else { + // restore to metaconsole database + metaconsole_restore_db(); + $module_source = db_get_all_rows_sql("SELECT id_agent_module FROM tgraph_source WHERE id_graph = " . $content['id_gs']); + foreach ($module_source as $key => $value) { + $modules[$key] = $value['id_agent_module']; + } + metaconsole_connect($server); + } } $id_graph = 0; } @@ -6408,7 +6418,7 @@ function reporting_custom_graph($report, $content, $type = 'dinamic', break; } - if ($config['metaconsole'] && $type_report != 'automatic_graph') { + if ($config['metaconsole']) { metaconsole_restore_db(); }