From 84d1979c9e6e9b52778dcd55be389eaf6b63eff8 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Wed, 18 Sep 2019 11:15:55 +0200 Subject: [PATCH] fixed error percentil label --- pandora_console/include/functions.php | 15 ++++++++++++--- pandora_console/include/functions_config.php | 4 ++++ pandora_console/include/functions_graph.php | 17 +++++++++-------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index b1027bc4af..afc950754e 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -3789,11 +3789,20 @@ function series_type_graph_array($data, $show_elements_graph) } else if (strpos($key, 'percentil') !== false) { $data_return['series_type'][$key] = 'percentil'; if ($show_elements_graph['percentil']) { - $data_return['legend'][$key] = __('Percentil').' '.$config['percentil'].'º '.__('of module').' '; if ($show_elements_graph['unit']) { - $name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$show_elements_graph['unit'].': '; + $name_legend = __('Percentil').' '; + $name_legend .= $config['percentil'].'º '; + $name_legend .= __('of module').' '; + $name_legend .= $value['agent_alias'].' / '; + $name_legend .= $value['module_name'].' / '; + $name_legend .= __('Unit ').' '; + $name_legend .= $show_elements_graph['unit'].': '; } else { - $name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].': '; + $name_legend = __('Percentil').' '; + $name_legend .= $config['percentil'].'º '; + $name_legend .= __('of module').' '; + $name_legend .= $value['agent_alias'].' / '; + $name_legend .= $value['module_name'].': '; } $data_return['legend'][$key] .= $name_legend; diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index f59061a03c..546678d762 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -2639,6 +2639,10 @@ function config_process_config() config_update_value('zoom_graph', 1); } + if (!isset($config['percentil'])) { + config_update_value('percentil', 95); + } + if (!isset($config['render_proc_ok'])) { config_update_value('render_proc_ok', __('Ok')); } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index d0e844c3bf..cbc0bceee5 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -302,6 +302,15 @@ function grafico_modulo_sparse_data( $array_data['sum'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias']; $array_data['sum'.$series_suffix]['unit'] = $data_module_graph['unit']; + if ($params['percentil']) { + $array_data['percentil'.$series_suffix]['agent_module_id'] = $agent_module_id; + $array_data['percentil'.$series_suffix]['id_module_type'] = $data_module_graph['id_module_type']; + $array_data['percentil'.$series_suffix]['agent_name'] = $data_module_graph['agent_name']; + $array_data['percentil'.$series_suffix]['module_name'] = $data_module_graph['module_name']; + $array_data['percentil'.$series_suffix]['agent_alias'] = $data_module_graph['agent_alias']; + $array_data['percentil'.$series_suffix]['unit'] = $data_module_graph['unit']; + } + // This is for a specific type of report that consists in passing // an interval and doing the average sum and avg. if ($params['force_interval'] != '') { @@ -378,12 +387,6 @@ function grafico_modulo_sparse_data( $array_data['sum1']['data'] = $acum_array_data; } - if ($params['percentil']) { - $percentil_value = $array_data['percentil'.$series_suffix]['data'][0][1]; - } else { - $percentil_value = 0; - } - $events = []; if (isset($array_data['sum'.$series_suffix]['max'])) { $max = $array_data['sum'.$series_suffix]['max']; @@ -1471,8 +1474,6 @@ function graphic_combined_module( $min = $array_data['sum'.$i]['min']; $avg = $array_data['sum'.$i]['avg']; - $percentil_value = $array_data['percentil'.$i]['data'][0][1]; - if ($config['fixed_graph'] == false) { $water_mark = [ 'file' => $config['homedir'].'/images/logo_vertical_water.png',