fixed errors in reports interfaces metaconsole
This commit is contained in:
parent
dd59704729
commit
f750d0f49e
|
@ -1967,7 +1967,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($module_list as $key => $value) {
|
foreach ($module_list as $key => $value) {
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole() && is_array($value)) {
|
||||||
$server = metaconsole_get_connection_by_id ($value['server']);
|
$server = metaconsole_get_connection_by_id ($value['server']);
|
||||||
metaconsole_connect($server);
|
metaconsole_connect($server);
|
||||||
$value = $value['module'];
|
$value = $value['module'];
|
||||||
|
@ -1987,14 +1987,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
||||||
$module_name_list[$key] = $alias . " / " . $module_name;
|
$module_name_list[$key] = $alias . " / " . $module_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole() && is_array($value)) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($percentil) && $percentil) {
|
if (!is_null($percentil) && $percentil) {
|
||||||
foreach ($module_list as $key => $value) {
|
foreach ($module_list as $key => $value) {
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole() && is_array($value)) {
|
||||||
$server = metaconsole_get_connection_by_id ($value['server']);
|
$server = metaconsole_get_connection_by_id ($value['server']);
|
||||||
metaconsole_connect($server);
|
metaconsole_connect($server);
|
||||||
$value = $value['module'];
|
$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);
|
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
|
||||||
$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
|
$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
|
||||||
|
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole() && is_array($value)) {
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2413,7 +2413,7 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p
|
||||||
$array_percentil = array();
|
$array_percentil = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole() && is_array($value_module)) {
|
||||||
$server = metaconsole_get_connection_by_id ($value_module['server']);
|
$server = metaconsole_get_connection_by_id ($value_module['server']);
|
||||||
metaconsole_connect($server);
|
metaconsole_connect($server);
|
||||||
$previous_data = modules_get_previous_data ($value_module['module'], $datelimit);
|
$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 ($data_uncompress as $key_data => $value_data) {
|
||||||
foreach ($value_data['data'] as $k => $v) {
|
foreach ($value_data['data'] as $k => $v) {
|
||||||
$real_date = $v['utimestamp'];
|
$real_date = $v['utimestamp'];
|
||||||
|
|
||||||
if(!isset($v['datos'])){
|
if(!isset($v['datos'])){
|
||||||
$v['datos'] = $previous_data;
|
$v['datos'] = $previous_data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2721,26 +2721,48 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
|
||||||
$filter = array(
|
$filter = array(
|
||||||
'id_grupo' => $content['id_group'],
|
'id_grupo' => $content['id_group'],
|
||||||
'disabled' => 0);
|
'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)) {
|
if (empty($network_interfaces_by_agents)) {
|
||||||
$return['failed'] =
|
$return['failed'] =
|
||||||
__('The group has no agents or none of the agents has any network interface');
|
__('The group has no agents or none of the agents has any network interface');
|
||||||
$return['data'] = array();
|
$return['data'] = array();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$return['failed'] = null;
|
|
||||||
$return['data'] = array();
|
|
||||||
|
|
||||||
foreach ($network_interfaces_by_agents as $agent_id => $agent) {
|
foreach ($network_interfaces_by_agents as $agent_id => $agent) {
|
||||||
$row_data = array();
|
$row_data = array();
|
||||||
|
|
||||||
$row_data['agent'] = $agent['name'];
|
$row_data['agent'] = $agent['name'];
|
||||||
|
|
||||||
$row_data['interfaces'] = array();
|
$row_data['interfaces'] = array();
|
||||||
foreach ($agent['interfaces'] as $interface_name => $interface) {
|
foreach ($agent['interfaces'] as $interface_name => $interface) {
|
||||||
$row_interface = array();
|
$row_interface = array();
|
||||||
|
|
||||||
$row_interface['name'] = $interface_name;
|
$row_interface['name'] = $interface_name;
|
||||||
$row_interface['ip'] = $interface['ip'];
|
$row_interface['ip'] = $interface['ip'];
|
||||||
$row_interface['mac'] = $interface['mac'];
|
$row_interface['mac'] = $interface['mac'];
|
||||||
|
@ -2818,14 +2840,12 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row_data['interfaces'][] = $row_interface;
|
$row_data['interfaces'][] = $row_interface;
|
||||||
}
|
}
|
||||||
|
|
||||||
$return['data'][] = $row_data;
|
$return['data'][] = $row_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return reporting_check_structure_content($return);
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue