Add percentil 95 in snmp graphics. internal ticket: 3
This commit is contained in:
parent
359f0aaac1
commit
2f93fddb6e
|
@ -164,10 +164,10 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$background_color = 'white', $modules_param = array(), $homeurl = '',
|
||||
$name_list = array(), $unit_list = array(), $show_last = true,
|
||||
$show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
|
||||
$dashboard = false, $vconsole = false) {
|
||||
$dashboard = false, $vconsole = false, $percentil = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
||||
if ($id_graph == 0) {
|
||||
$graph_conf['stacked'] = CUSTOM_GRAPH_LINE;
|
||||
}
|
||||
|
@ -244,7 +244,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$show_avg,
|
||||
$labels,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
$vconsole,
|
||||
$percentil);
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
|
|
@ -465,7 +465,6 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (!is_null($percentil)) {
|
||||
$avg = array_map(function($item) { return $item['sum'];}, $chart);
|
||||
|
||||
|
@ -977,7 +976,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$only_image = false, $homeurl = '', $ttl = 1, $projection = false,
|
||||
$prediction_period = false, $background_color = 'white',
|
||||
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
|
||||
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false, $vconsole = false) {
|
||||
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
|
||||
$vconsole = false, $percentil = 0) {
|
||||
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
@ -1705,9 +1705,28 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
foreach ($graph_values as $graph_group => $point) {
|
||||
foreach ($point as $timestamp_point => $point_value) {
|
||||
$temp[$timestamp_point][$graph_group] = $point_value;
|
||||
if (!is_null($percentil)) {
|
||||
|
||||
foreach ($graph_values as $graph_group => $point) {
|
||||
foreach ($point as $timestamp_point => $point_value) {
|
||||
$temp[$timestamp_point][$graph_group] = $point_value;
|
||||
}
|
||||
|
||||
$percentile_value = get_percentile($percentil, $point);
|
||||
$percentil_result[$graph_group] = array_fill ( 0, count($point), $percentile_value);
|
||||
$series_type[$graph_group] = 'line';
|
||||
$agent_name = io_safe_output(
|
||||
modules_get_agentmodule_agent_name ($module_list[$graph_group]));
|
||||
$module_name = io_safe_output(
|
||||
modules_get_agentmodule_name ($module_list[$graph_group]));
|
||||
$module_name_list['percentil'.$graph_group] = __('Percentile %dº', $percentil) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentile_value . ' ' . $unit . ') ';
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach ($graph_values as $graph_group => $point) {
|
||||
foreach ($point as $timestamp_point => $point_value) {
|
||||
$temp[$timestamp_point][$graph_group] = $point_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1787,7 +1806,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
return area_graph($flash_charts, $graph_values, $width,
|
||||
$height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $homeurl, $water_mark, $config['fontpath'],
|
||||
$title, "", $homeurl, $water_mark, $config['fontpath'],
|
||||
$fixed_font_size, $unit, $ttl, array(), array(), 0, 0, '',
|
||||
false, '', true, $background_color,$dashboard, $vconsole);
|
||||
break;
|
||||
|
@ -1796,22 +1815,23 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
return stacked_area_graph($flash_charts, $graph_values,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
$title, "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
||||
break;
|
||||
case CUSTOM_GRAPH_LINE:
|
||||
return line_graph($flash_charts, $graph_values, $width,
|
||||
$height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
$unit, $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
||||
$title, "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
$unit, $ttl, $homeurl, $background_color, $dashboard,
|
||||
$vconsole, $series_type, $percentil_result);
|
||||
break;
|
||||
case CUSTOM_GRAPH_STACKED_LINE:
|
||||
return stacked_line_graph($flash_charts, $graph_values,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
||||
"", $ttl, $homeurl, $background_color, $dashboard, $vconsole);
|
||||
break;
|
||||
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
||||
case CUSTOM_GRAPH_BULLET_CHART:
|
||||
|
|
|
@ -510,7 +510,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $no_data_image, $xaxisname = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false, $vconsole = false) {
|
||||
$dashboard = false, $vconsole = false, $series_type = array(),
|
||||
$percentil_values = array()) {
|
||||
|
||||
include_once("functions_flot.php");
|
||||
|
||||
|
@ -535,7 +536,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$font_size,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
array(),
|
||||
$series_type,
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
|
@ -545,7 +546,9 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$menu,
|
||||
$backgroundColor,
|
||||
$dashboard,
|
||||
$vconsole);
|
||||
$vconsole,
|
||||
false,
|
||||
$percentil_values);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
|
|
|
@ -980,9 +980,9 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
|
|||
//threshold: [{ below: 80, color: "rgb(200, 20, 30)" } , { below: 65, color: "rgb(30, 200, 30)" }, { below: 50, color: "rgb(30, 200, 30)" }],
|
||||
lines: {
|
||||
show: line_show,
|
||||
fill: 0.2,
|
||||
fill: 0.4,
|
||||
fillColor: {
|
||||
colors: [ { opacity: 0.9 }, { opacity: 0.6 } ]
|
||||
colors: [ { opacity: 0.3 }, { opacity: 0.7 } ]
|
||||
},
|
||||
lineWidth: lineWidth,
|
||||
steps: steps_chart
|
||||
|
|
|
@ -142,11 +142,12 @@ function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
|||
}
|
||||
|
||||
function flot_line_simple_graph($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl = '', $font = '', $font_size = 7,$unit = '', $water_mark = '',
|
||||
$legend, $long_index, $homeurl = '', $font = '', $font_size = 7, $unit = '', $water_mark = '',
|
||||
$serie_types = array(), $chart_extra_data = array(),
|
||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0) {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false,
|
||||
$agent_module_id = 0, $percentil_values = array()) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -154,14 +155,17 @@ function flot_line_simple_graph($chart_data, $width, $height, $color,
|
|||
$legend, $long_index, $homeurl, $unit, 'line_simple',
|
||||
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
||||
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
||||
$menu, $background_color, $dashboard, $vconsole, $agent_module_id, $font, $font_size);
|
||||
$menu, $background_color, $dashboard, $vconsole,
|
||||
$agent_module_id, $font, $font_size, '', $percentil_values);
|
||||
}
|
||||
|
||||
function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
||||
$long_index, $homeurl, $unit, $type, $water_mark, $serie_types,
|
||||
$chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key,
|
||||
$force_integer, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false, $agent_module_id = 0,$font = '',$font_size = 7, $xaxisname = '') {
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false,
|
||||
$agent_module_id = 0,$font = '',$font_size = 7, $xaxisname = '',
|
||||
$percentil_values = array()) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -325,6 +329,14 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($percentil_values)) {
|
||||
foreach($percentil_values as $key => $value) {
|
||||
$jsvar = "percentil_" . $graph_id . "_" . $key;
|
||||
$serie_types2[$jsvar] = 'line';
|
||||
$data[$jsvar] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Store data series in javascript format
|
||||
$jsvars = '';
|
||||
|
|
|
@ -144,6 +144,7 @@ $interface_traffic_modules = array(
|
|||
$start_date = (string) get_parameter("start_date", date("Y-m-d"));
|
||||
$zoom = (int) get_parameter ("zoom", 1);
|
||||
$baseline = get_parameter ("baseline", 0);
|
||||
$show_percentil_95 = get_parameter ("show_percentil_95", 0);
|
||||
|
||||
if ($zoom > 1) {
|
||||
$height = $height * ($zoom / 2.1);
|
||||
|
@ -179,7 +180,14 @@ $interface_traffic_modules = array(
|
|||
$config['homeurl'],
|
||||
array_keys($interface_traffic_modules),
|
||||
array_fill(0, count($interface_traffic_modules), $config["interface_unit"]),
|
||||
false);
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
1,
|
||||
false,
|
||||
false,
|
||||
(($show_percentil_95)? 95 : null));
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
@ -226,6 +234,12 @@ $interface_traffic_modules = array(
|
|||
$table->data[] = $data;
|
||||
$table->rowclass[] = '';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Show percentil 95º');
|
||||
$data[1] = html_print_checkbox ("show_percentil_95", 1, (bool) $show_percentil_95, true);
|
||||
$table->data[] = $data;
|
||||
$table->rowclass[] ='';
|
||||
|
||||
$data = array();
|
||||
$data[0] = __('Zoom factor');
|
||||
$options = array();
|
||||
|
|
Loading…
Reference in New Issue