mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Add percentil 95 in snmp graphics. internal ticket: 3
This commit is contained in:
parent
359f0aaac1
commit
2f93fddb6e
@ -164,7 +164,7 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||||||
$background_color = 'white', $modules_param = array(), $homeurl = '',
|
$background_color = 'white', $modules_param = array(), $homeurl = '',
|
||||||
$name_list = array(), $unit_list = array(), $show_last = true,
|
$name_list = array(), $unit_list = array(), $show_last = true,
|
||||||
$show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
|
$show_max = true, $show_min = true, $show_avg = true, $ttl = 1,
|
||||||
$dashboard = false, $vconsole = false) {
|
$dashboard = false, $vconsole = false, $percentil = 0) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -244,7 +244,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||||||
$show_avg,
|
$show_avg,
|
||||||
$labels,
|
$labels,
|
||||||
$dashboard,
|
$dashboard,
|
||||||
$vconsole);
|
$vconsole,
|
||||||
|
$percentil);
|
||||||
|
|
||||||
if ($return)
|
if ($return)
|
||||||
return $output;
|
return $output;
|
||||||
|
@ -465,7 +465,6 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!is_null($percentil)) {
|
if (!is_null($percentil)) {
|
||||||
$avg = array_map(function($item) { return $item['sum'];}, $chart);
|
$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,
|
$only_image = false, $homeurl = '', $ttl = 1, $projection = false,
|
||||||
$prediction_period = false, $background_color = 'white',
|
$prediction_period = false, $background_color = 'white',
|
||||||
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
|
$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 $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
@ -1705,9 +1705,28 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
foreach ($graph_values as $graph_group => $point) {
|
if (!is_null($percentil)) {
|
||||||
foreach ($point as $timestamp_point => $point_value) {
|
|
||||||
$temp[$timestamp_point][$graph_group] = $point_value;
|
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;
|
break;
|
||||||
@ -1787,7 +1806,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
return area_graph($flash_charts, $graph_values, $width,
|
return area_graph($flash_charts, $graph_values, $width,
|
||||||
$height, $color, $module_name_list, $long_index,
|
$height, $color, $module_name_list, $long_index,
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
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, '',
|
$fixed_font_size, $unit, $ttl, array(), array(), 0, 0, '',
|
||||||
false, '', true, $background_color,$dashboard, $vconsole);
|
false, '', true, $background_color,$dashboard, $vconsole);
|
||||||
break;
|
break;
|
||||||
@ -1796,22 +1815,23 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||||||
return stacked_area_graph($flash_charts, $graph_values,
|
return stacked_area_graph($flash_charts, $graph_values,
|
||||||
$width, $height, $color, $module_name_list, $long_index,
|
$width, $height, $color, $module_name_list, $long_index,
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
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);
|
"", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_LINE:
|
case CUSTOM_GRAPH_LINE:
|
||||||
return line_graph($flash_charts, $graph_values, $width,
|
return line_graph($flash_charts, $graph_values, $width,
|
||||||
$height, $color, $module_name_list, $long_index,
|
$height, $color, $module_name_list, $long_index,
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
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,
|
||||||
$unit, $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
$unit, $ttl, $homeurl, $background_color, $dashboard,
|
||||||
|
$vconsole, $series_type, $percentil_result);
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_STACKED_LINE:
|
case CUSTOM_GRAPH_STACKED_LINE:
|
||||||
return stacked_line_graph($flash_charts, $graph_values,
|
return stacked_line_graph($flash_charts, $graph_values,
|
||||||
$width, $height, $color, $module_name_list, $long_index,
|
$width, $height, $color, $module_name_list, $long_index,
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||||
"", $ttl, $homeurl, $background_color,$dashboard, $vconsole);
|
"", $ttl, $homeurl, $background_color, $dashboard, $vconsole);
|
||||||
break;
|
break;
|
||||||
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
case CUSTOM_GRAPH_BULLET_CHART_THRESHOLD:
|
||||||
case CUSTOM_GRAPH_BULLET_CHART:
|
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 = "",
|
$legend, $long_index, $no_data_image, $xaxisname = "",
|
||||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
$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");
|
include_once("functions_flot.php");
|
||||||
|
|
||||||
@ -535,7 +536,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
$font_size,
|
$font_size,
|
||||||
$unit,
|
$unit,
|
||||||
$water_mark_url,
|
$water_mark_url,
|
||||||
array(),
|
$series_type,
|
||||||
array(),
|
array(),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -545,7 +546,9 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||||||
$menu,
|
$menu,
|
||||||
$backgroundColor,
|
$backgroundColor,
|
||||||
$dashboard,
|
$dashboard,
|
||||||
$vconsole);
|
$vconsole,
|
||||||
|
false,
|
||||||
|
$percentil_values);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$graph = array();
|
$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)" }],
|
//threshold: [{ below: 80, color: "rgb(200, 20, 30)" } , { below: 65, color: "rgb(30, 200, 30)" }, { below: 50, color: "rgb(30, 200, 30)" }],
|
||||||
lines: {
|
lines: {
|
||||||
show: line_show,
|
show: line_show,
|
||||||
fill: 0.2,
|
fill: 0.4,
|
||||||
fillColor: {
|
fillColor: {
|
||||||
colors: [ { opacity: 0.9 }, { opacity: 0.6 } ]
|
colors: [ { opacity: 0.3 }, { opacity: 0.7 } ]
|
||||||
},
|
},
|
||||||
lineWidth: lineWidth,
|
lineWidth: lineWidth,
|
||||||
steps: steps_chart
|
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,
|
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(),
|
$serie_types = array(), $chart_extra_data = array(),
|
||||||
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
$yellow_threshold = 0, $red_threshold = 0, $adapt_key= '',
|
||||||
$force_integer = false, $series_suffix_str = '', $menu = true,
|
$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;
|
global $config;
|
||||||
|
|
||||||
@ -154,14 +155,17 @@ function flot_line_simple_graph($chart_data, $width, $height, $color,
|
|||||||
$legend, $long_index, $homeurl, $unit, 'line_simple',
|
$legend, $long_index, $homeurl, $unit, 'line_simple',
|
||||||
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
$water_mark, $serie_types, $chart_extra_data, $yellow_threshold,
|
||||||
$red_threshold, $adapt_key, $force_integer, $series_suffix_str,
|
$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,
|
function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
||||||
$long_index, $homeurl, $unit, $type, $water_mark, $serie_types,
|
$long_index, $homeurl, $unit, $type, $water_mark, $serie_types,
|
||||||
$chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key,
|
$chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key,
|
||||||
$force_integer, $series_suffix_str = '', $menu = true,
|
$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;
|
global $config;
|
||||||
|
|
||||||
@ -326,6 +330,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
|
// Store data series in javascript format
|
||||||
$jsvars = '';
|
$jsvars = '';
|
||||||
$jsseries = array();
|
$jsseries = array();
|
||||||
|
@ -144,6 +144,7 @@ $interface_traffic_modules = array(
|
|||||||
$start_date = (string) get_parameter("start_date", date("Y-m-d"));
|
$start_date = (string) get_parameter("start_date", date("Y-m-d"));
|
||||||
$zoom = (int) get_parameter ("zoom", 1);
|
$zoom = (int) get_parameter ("zoom", 1);
|
||||||
$baseline = get_parameter ("baseline", 0);
|
$baseline = get_parameter ("baseline", 0);
|
||||||
|
$show_percentil_95 = get_parameter ("show_percentil_95", 0);
|
||||||
|
|
||||||
if ($zoom > 1) {
|
if ($zoom > 1) {
|
||||||
$height = $height * ($zoom / 2.1);
|
$height = $height * ($zoom / 2.1);
|
||||||
@ -179,7 +180,14 @@ $interface_traffic_modules = array(
|
|||||||
$config['homeurl'],
|
$config['homeurl'],
|
||||||
array_keys($interface_traffic_modules),
|
array_keys($interface_traffic_modules),
|
||||||
array_fill(0, count($interface_traffic_modules), $config["interface_unit"]),
|
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>';
|
echo '</div>';
|
||||||
|
|
||||||
@ -226,6 +234,12 @@ $interface_traffic_modules = array(
|
|||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
$table->rowclass[] = '';
|
$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 = array();
|
||||||
$data[0] = __('Zoom factor');
|
$data[0] = __('Zoom factor');
|
||||||
$options = array();
|
$options = array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user