diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 3462366c0d..d717115ac3 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1967,7 +1967,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, } foreach ($module_list as $key => $value) { - if (is_metaconsole()) { + if (is_metaconsole() && is_array($value)) { $server = metaconsole_get_connection_by_id ($value['server']); metaconsole_connect($server); $value = $value['module']; @@ -1987,14 +1987,14 @@ function graphic_combined_module ($module_list, $weight_list, $period, $module_name_list[$key] = $alias . " / " . $module_name; } } - if (is_metaconsole()) { + if (is_metaconsole() && is_array($value)) { metaconsole_restore_db(); } } if (!is_null($percentil) && $percentil) { foreach ($module_list as $key => $value) { - if (is_metaconsole()) { + if (is_metaconsole() && is_array($value)) { $server = metaconsole_get_connection_by_id ($value['server']); metaconsole_connect($server); $value = $value['module']; @@ -2004,7 +2004,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $alias = db_get_value ("alias","tagente","nombre",$agent_name); $module_name = io_safe_output( modules_get_agentmodule_name ($value) ); - if (is_metaconsole()) { + if (is_metaconsole() && is_array($value)) { metaconsole_restore_db(); } @@ -2413,7 +2413,7 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p $array_percentil = array(); } - if (is_metaconsole()) { + if (is_metaconsole() && is_array($value_module)) { $server = metaconsole_get_connection_by_id ($value_module['server']); metaconsole_connect($server); $previous_data = modules_get_previous_data ($value_module['module'], $datelimit); @@ -2428,7 +2428,6 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p foreach ($data_uncompress as $key_data => $value_data) { foreach ($value_data['data'] as $k => $v) { $real_date = $v['utimestamp']; - if(!isset($v['datos'])){ $v['datos'] = $previous_data; } @@ -6464,4 +6463,4 @@ function graph_monitor_wheel ($width = 550, $height = 600, $filter = false) { return d3_sunburst_graph ($graph_data, $width, $height, true); } -?> \ No newline at end of file +?> diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 1d53f61114..b63b7cd5b9 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2721,44 +2721,66 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic $filter = array( 'id_grupo' => $content['id_group'], 'disabled' => 0); - $network_interfaces_by_agents = agents_get_network_interfaces(false, $filter); - + + $return['failed'] = null; + $return['data'] = array(); + + if ($config['metaconsole']) { + $server_names = metaconsole_get_connection_names(); + if(isset($server_names) && is_array($server_names)){ + foreach ($server_names as $key => $value) { + $id_meta = metaconsole_get_id_server($value); + $connection = metaconsole_get_connection_by_id ($id_meta); + if (metaconsole_connect($connection) != NOERR) { + continue; + } + else{ + $network_interfaces_by_agents = agents_get_network_interfaces(false, $filter); + $return = agents_get_network_interfaces_array($network_interfaces_by_agents, $return, $type, $content, $report); + metaconsole_restore_db(); + } + } + } + } + else{ + $network_interfaces_by_agents = agents_get_network_interfaces(false, $filter); + agents_get_network_interfaces_array($network_interfaces_by_agents, $return, $type, $content, $report); + } + + return reporting_check_structure_content($return); +} + +function agents_get_network_interfaces_array($network_interfaces_by_agents, $return, $type, $content, $report){ if (empty($network_interfaces_by_agents)) { $return['failed'] = __('The group has no agents or none of the agents has any network interface'); $return['data'] = array(); } else { - $return['failed'] = null; - $return['data'] = array(); - foreach ($network_interfaces_by_agents as $agent_id => $agent) { $row_data = array(); - $row_data['agent'] = $agent['name']; - $row_data['interfaces'] = array(); foreach ($agent['interfaces'] as $interface_name => $interface) { $row_interface = array(); - $row_interface['name'] = $interface_name; $row_interface['ip'] = $interface['ip']; $row_interface['mac'] = $interface['mac']; $row_interface['status'] = $interface['status_image']; $row_interface['chart'] = null; - + // Get chart reporting_set_conf_charts($width, $height, $only_image, $type, $content, $ttl); - + if (!empty($force_width_chart)) { $width = $force_width_chart; } - + if (!empty($force_height_chart)) { $height = $force_height_chart; } - + switch ($type) { case 'dinamic': if (!empty($interface['traffic'])) { @@ -2818,14 +2840,12 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic } break; } - $row_data['interfaces'][] = $row_interface; } - $return['data'][] = $row_data; } } - return reporting_check_structure_content($return); + return $return; } /**