fixed errors in automatic combined graph meta with TIP

This commit is contained in:
daniel 2018-02-08 17:07:54 +01:00
parent a5a6371270
commit 3e0edcfda8
1 changed files with 75 additions and 38 deletions

View File

@ -1967,6 +1967,15 @@ function graphic_combined_module ($module_list, $weight_list, $period,
}
foreach ($module_list as $key => $value) {
if (is_metaconsole()) {
$server = metaconsole_get_connection_by_id ($value['server']);
metaconsole_connect($server);
$value = $value['module'];
}
if ($labels[$value] != ''){
$module_name_list[$key] = $labels[$value];
}
else {
$agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) );
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
@ -1978,12 +1987,27 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$module_name_list[$key] = $alias . " / " . $module_name;
}
}
if (is_metaconsole()) {
metaconsole_restore_db();
}
}
if (!is_null($percentil) && $percentil) {
foreach ($module_list as $key => $value) {
if (is_metaconsole()) {
$server = metaconsole_get_connection_by_id ($value['server']);
metaconsole_connect($server);
$value = $value['module'];
}
$agent_name = io_safe_output( modules_get_agentmodule_agent_name ($value) );
$alias = db_get_value ("alias","tagente","nombre",$agent_name);
$module_name = io_safe_output( modules_get_agentmodule_name ($value) );
if (is_metaconsole()) {
metaconsole_restore_db();
}
$module_name_list['percentil'.$key] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentil_result[$key][0] . ' ' . $unit . ') ';
$series_type[$key] = 'line';
}
@ -2389,17 +2413,21 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p
$array_percentil = array();
}
if (is_metaconsole()) {
$server = metaconsole_get_connection_by_id ($value_module['server']);
metaconsole_connect($server);
$previous_data = modules_get_previous_data ($value_module['module'], $datelimit);
$data_uncompress = db_uncompress_module_data($value_module['module'], $datelimit, $date);
metaconsole_restore_db();
}
else{
$previous_data = modules_get_previous_data ($value_module, $datelimit);
$data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date);
}
foreach ($data_uncompress as $key_data => $value_data) {
foreach ($value_data['data'] as $k => $v) {
if($flash_charts) {
$real_date = date("Y M d H:i:s", $v['utimestamp']);
}
else{
$real_date = $v['utimestamp'];
}
if(!isset($v['datos'])){
$v['datos'] = $previous_data;
@ -2434,9 +2462,17 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p
}
$data_prev = array();
$data_all_rev = array();
ksort($data_all);
foreach ($data_all as $key => $value) {
if($flash_charts) {
$real_date = date("Y M d H:i:s", $key);
}
else{
$real_date = $key;
}
foreach ($module_list as $key_module => $value_module) {
if(!isset($value[$key_module])){
$data_all[$key][$key_module] = $data_prev[$key_module];
@ -2445,13 +2481,14 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p
$data_prev[$key_module] = $value[$key_module];
}
}
$data_all_rev[$real_date] = $data_all[$key];
}
if (!is_null($percentil) && $percentil) {
$data_all['percentil'] = $percentil_result;
$data_all_rev['percentil'] = $percentil_result;
}
return $data_all;
return $data_all_rev;
}
/**