diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php
index 3de1dbd138..1ae4d7cc17 100644
--- a/pandora_console/godmode/reporting/graph_builder.main.php
+++ b/pandora_console/godmode/reporting/graph_builder.main.php
@@ -65,6 +65,7 @@ if ($edit_graph) {
$width = $graphInTgraph['width'];
$height = $graphInTgraph['height'];
$check = false;
+ $percentil = $graphInTgraph['percentil'];
if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = CUSTOM_GRAPH_BULLET_CHART;
@@ -82,6 +83,7 @@ else {
$factor = 1;
$stacked = 4;
$check = false;
+ $percentil = 0;
}
@@ -170,10 +172,11 @@ echo "
 
html_print_checkbox('threshold', CUSTOM_GRAPH_BULLET_CHART_THRESHOLD, $check, false, false, '', false);
echo "
";
-
-
echo "";
+echo "".__('Type of graph')." | ";
+echo "" . html_print_checkbox ("percentil", 1, $percentil, true) . " |
";
+
echo "";
if ($edit_graph) {
diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php
index ce39bcb093..0e26daab76 100644
--- a/pandora_console/godmode/reporting/graph_builder.php
+++ b/pandora_console/godmode/reporting/graph_builder.php
@@ -75,6 +75,7 @@ if ($add_graph) {
$stacked = get_parameter ("stacked", 0);
$period = get_parameter_post ("period");
$threshold = get_parameter('threshold');
+ $percentil = get_parameter ("percentil", 0);
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = $threshold;
@@ -90,7 +91,9 @@ if ($add_graph) {
'height' => $height,
'private' => 0,
'id_group' => $idGroup,
- 'stacked' => $stacked);
+ 'stacked' => $stacked,
+ 'percentil' => $percentil
+ );
if (trim($name) != "") {
$id_graph = db_process_sql_insert('tgraph', $values);
@@ -116,6 +119,7 @@ if ($update_graph) {
$height = get_parameter('height');
$period = get_parameter('period');
$stacked = get_parameter('stacked');
+ $percentil = get_parameter('percentil');
$alerts = get_parameter('alerts');
$threshold = get_parameter('threshold');
@@ -126,7 +130,7 @@ if ($update_graph) {
if (trim($name) != "") {
$success = db_process_sql_update('tgraph',
- array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked),
+ array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ),
array('id_graph' => $id_graph));
if ($success !== false)
db_pandora_audit("Report management", "Update graph #$id_graph");
diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index 9291cacdba..750627b5f8 100644
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -1743,14 +1743,14 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$temp[$timestamp_point][$graph_group] = $point_value;
}
- $percentile_value = get_percentile($percentil, $point);
+ $percentile_value = get_percentile($config['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 . ') ';
+ $module_name_list['percentil'.$graph_group] = __('Percentile %dº', $config['percentil']) . __(' of module ') . $agent_name .' / ' . $module_name . ' (' . $percentile_value . ' ' . $unit . ') ';
}
}
else {
@@ -1869,7 +1869,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$red_threshold = $compare_critical;
}
}
-
switch ($stacked) {
case CUSTOM_GRAPH_AREA:
return area_graph($flash_charts, $graph_values, $width,
@@ -1877,7 +1876,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
$title, "", $homeurl, $water_mark, $config['fontpath'],
$fixed_font_size, $unit, $ttl, array(), array(), $yellow_threshold, $red_threshold, '',
- false, '', true, $background_color,$dashboard, $vconsole);
+ false, '', true, $background_color,$dashboard, $vconsole, 0, $percentil_result);
break;
default:
case CUSTOM_GRAPH_STACKED_AREA:
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index d5beded9e6..053fa2e04f 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -5607,7 +5607,6 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
}
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
-
$return = array();
$return['type'] = 'custom_graph';
@@ -5684,7 +5683,11 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
true,
true,
true,
- $labels);
+ $labels,
+ false,
+ false,
+ $graph["percentil"]
+ );
break;
case 'data':
break;
diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php
index d0fe0556b2..b27154c6c6 100755
--- a/pandora_console/include/functions_visual_map.php
+++ b/pandora_console/include/functions_visual_map.php
@@ -770,19 +770,16 @@ function visual_map_print_item($mode = "read", $layoutData,
if ($layoutData['id_custom_graph'] != 0) {
// Show only avg on the visual console
if(get_parameter('action') == 'edit'){
-
- $img = '';
-
- }
+ $img = '';
+ }
else{
-
$img = custom_graphs_print(
- $layoutData['id_custom_graph'], $height, $width,
- $period, null, true, 0, false, $layoutData['image'],
- array(), '', array(), array(), true,
- false, false, true, 1, false, true);
-
- }
+ $layoutData['id_custom_graph'], $height, $width,
+ $period, null, true, 0, false, $layoutData['image'],
+ array(), '', array(), array(), true,
+ false, false, true, 1, false, true, $layoutData['percentil']
+ );
+ }
@@ -794,19 +791,15 @@ function visual_map_print_item($mode = "read", $layoutData,
$homeurl = '';
if(get_parameter('action') == 'edit'){
-
- $img = '';
-
- }
- else{
-
- $img = grafico_modulo_sparse($id_module, $period, 0,$width,$height,
- '',null,
- false, 1, false, 0, '', 0, 0, true, false, '', 1, false,
- '', false, false, false, $layoutData['image'], null, true, false,$type_graph);
-
- }
- }
+ $img = '';
+ }
+ else {
+ $img = grafico_modulo_sparse($id_module, $period, 0, $width, $height, '', null,
+ false, 1, false, 0, '', 0, 0, true, false, '', 1, false,
+ '', false, false, false, $layoutData['image'], null, true,
+ false,$type_graph);
+ }
+ }
//Restore db connection
if ($layoutData['id_metaconsole'] != 0) {
@@ -2193,7 +2186,12 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
'proportion_height' => $proportion_height,
'proportion_width' => $proportion_width);
}
-
+
+ if($layout_data['id_custom_graph']){
+ $layout_data['percentil'] = db_get_value ("percentil", "tgraph",
+ "id_graph", $layout_data["id_custom_graph"]);
+ }
+
switch ($layout_data['type']) {
case LINE_ITEM:
visual_map_print_user_lines($layout_data, $proportion);
diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php
index b69ddcbcae..39f836d910 100644
--- a/pandora_console/include/graphs/fgraph.php
+++ b/pandora_console/include/graphs/fgraph.php
@@ -219,7 +219,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
$chart_extra_data = array(), $yellow_threshold = 0,
$red_threshold = 0, $adapt_key = '', $force_integer = false,
$series_suffix_str = '', $menu = true, $backgroundColor = 'white',
- $dashboard = false, $vconsole = false, $agent_module_id = 0) {
+ $dashboard = false, $vconsole = false, $agent_module_id = 0, $percentil_values = array()) {
include_once('functions_flot.php');
@@ -266,7 +266,9 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
$agent_module_id,
$font,
$font_size,
- $xaxisname);
+ $xaxisname,
+ $percentil_values
+ );
}
else {
$graph = array();
diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php
index 2bf220bede..b29837b168 100644
--- a/pandora_console/include/graphs/functions_flot.php
+++ b/pandora_console/include/graphs/functions_flot.php
@@ -118,7 +118,8 @@ function flot_area_simple_graph($chart_data, $width, $height, $color,
$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, $font = '', $font_size = 7, $xaxisname = '') {
+ $agent_module_id = 0, $font = '', $font_size = 7, $xaxisname = '',
+ $percentil_values = array()) {
global $config;
@@ -127,7 +128,7 @@ function flot_area_simple_graph($chart_data, $width, $height, $color,
$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, $xaxisname);
+ $agent_module_id, $font, $font_size, $xaxisname, $percentil_values);
}
function flot_line_stacked_graph($chart_data, $width, $height, $color,
diff --git a/pandora_console/operation/reporting/graph_viewer.php b/pandora_console/operation/reporting/graph_viewer.php
index 6a2d6aa15f..8e31bc8c83 100644
--- a/pandora_console/operation/reporting/graph_viewer.php
+++ b/pandora_console/operation/reporting/graph_viewer.php
@@ -94,6 +94,7 @@ if ($view_graph) {
$events = $graph["events"];
$description = $graph["description"];
$stacked = (int) get_parameter ('stacked', -1);
+ $percentil = (int) get_parameter ('percentil', 0);
$check = get_parameter('threshold',false);
if($check == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
@@ -164,9 +165,8 @@ if ($view_graph) {
__('Custom graphs') . " - " . $graph['name'],
"images/chart.png", false, "", false, $options);
- $graph_return = custom_graphs_print($id_graph, $height, $width, $period, $stacked,
- true, $unixdate);
-
+ $graph_return = custom_graphs_print($id_graph, $height, $width, $period, $stacked, true, $unixdate, false, 'white',
+ array(), '', array(), array(), true, true, true, true, 1, false, false, $percentil, false);
if ($graph_return){
echo "