diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php index 79242ace64..6ca2caa53b 100644 --- a/pandora_console/include/chart_generator.php +++ b/pandora_console/include/chart_generator.php @@ -101,7 +101,7 @@ $params = json_decode($_REQUEST['data'], true); // Metaconsole connection to the node. $server_id = $params['server_id']; -if ($config['metaconsole'] && !empty($server_id)) { +if (is_metaconsole() && !empty($server_id)) { $server = metaconsole_get_connection_by_id($server_id); // Error connecting. if (metaconsole_connect($server) !== NOERR) { diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index a3cbaabdf4..f2e350dc8f 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -3851,9 +3851,11 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false $file_js = $config['homedir'].'/include/web2image.js'; $url = ui_get_full_url(false).$hack_metaconsole.'/include/chart_generator.php'; - $img_file = 'img_'.uniqid().'.png'; - $img_path = $config['homedir'].'/attachment/'.$img_file; - $img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file; + if (!$params['return_img_base_64']) { + $img_file = 'img_'.uniqid().'.png'; + $img_path = $config['homedir'].'/attachment/'.$img_file; + $img_url = ui_get_full_url(false).$hack_metaconsole.'/attachment/'.$img_file; + } $width_img = 500; @@ -3866,8 +3868,8 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined=false } if ($type_graph_pdf === 'slicebar') { - $height_img = 70; - $params['height'] = 70; + $height_img = 90; + $params['height'] = 90; } $params_encode_json = urlencode(json_encode($params)); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 2f1c481679..3dd290e59e 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -291,16 +291,18 @@ function reporting_make_reporting_data( $agents_to_macro = $content['id_agent']; } - // Metaconsole connection. - if (is_metaconsole()) { - $server = metaconsole_get_connection_names(); - $connection = metaconsole_get_connection($server); - if (metaconsole_connect($connection) != NOERR) { - continue; - } - } - if (isset($content['style']['name_label'])) { + $server_name = $content['server_name']; + $metaconsole_on = is_metaconsole(); + + // Metaconsole connection. + if ($metaconsole_on && $server_name != '') { + $connection = metaconsole_get_connection($server_name); + if (!metaconsole_load_external_db($connection)) { + continue; + } + } + // Add macros name. $items_label = []; $items_label['type'] = $content['type']; @@ -309,8 +311,6 @@ function reporting_make_reporting_data( $items_label['modules'] = $modules_to_macro; $items_label['agents'] = $agents_to_macro; $items_label['visual_format'] = $visual_format; - $metaconsole_on = is_metaconsole(); - $server_name = $content['server_name']; $items_label['agent_description'] = agents_get_description( $content['id_agent'] @@ -7551,12 +7551,10 @@ function reporting_custom_graph( if ($type_report == 'custom_graph') { if (is_metaconsole()) { - $servers = metaconsole_get_connection_names(); - foreach ($servers as $server) { - $connection = metaconsole_get_connection($server); - if (metaconsole_connect($connection) != NOERR) { - continue; - } + $id_meta = metaconsole_get_id_server($content['server_name']); + $server = metaconsole_get_connection_by_id($id_meta); + if (metaconsole_connect($server) != NOERR) { + return false; } } }