Merge branch '156-mostrar-umbrale-warning-y-critical-en-gráficas-de-interfaces-SNMP' into 'pandora_6.0'
156 mostrar umbrale warning y critical en gráficas de interfaces snmp See merge request !41
This commit is contained in:
commit
8ca7b3bcbd
|
@ -255,7 +255,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$labels,
|
||||
$dashboard,
|
||||
$vconsole,
|
||||
$percentil);
|
||||
$percentil,
|
||||
$from_interface);
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
|
|
@ -973,7 +973,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$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, $percentil = null) {
|
||||
$vconsole = false, $percentil = null, $from_interface = false) {
|
||||
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
@ -1707,6 +1707,116 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
'color' => COL_GRAPH13,
|
||||
'alpha' => CHART_DEFAULT_ALPHA);
|
||||
|
||||
$threshold_data = array();
|
||||
|
||||
if ($from_interface) {
|
||||
$yellow_threshold = 0;
|
||||
$red_threshold = 0;
|
||||
|
||||
$yellow_up = 0;
|
||||
$red_up = 0;
|
||||
|
||||
$yellow_inverse = 0;
|
||||
$red_inverse = 0;
|
||||
|
||||
$compare_warning = false;
|
||||
$compare_critical = false;
|
||||
|
||||
$do_it_warning_min = true;
|
||||
$do_it_critical_min = true;
|
||||
|
||||
$do_it_warning_max = true;
|
||||
$do_it_critical_max = true;
|
||||
|
||||
$do_it_warning_inverse = true;
|
||||
$do_it_critical_inverse = true;
|
||||
foreach ($module_list as $index => $id_module) {
|
||||
// Get module warning_min and critical_min
|
||||
$warning_min = db_get_value('min_warning','tagente_modulo','id_agente_modulo',$id_module);
|
||||
$critical_min = db_get_value('min_critical','tagente_modulo','id_agente_modulo',$id_module);
|
||||
|
||||
if ($index == 0) {
|
||||
$compare_warning = $warning_min;
|
||||
}
|
||||
else {
|
||||
if ($compare_warning != $warning_min) {
|
||||
$do_it_warning_min = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($index == 0) {
|
||||
$compare_critical = $critical_min;
|
||||
}
|
||||
else {
|
||||
if ($compare_critical != $critical_min) {
|
||||
$do_it_critical_min = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_it_warning_min || $do_it_critical_min) {
|
||||
foreach ($module_list as $index => $id_module) {
|
||||
$warning_max = db_get_value('max_warning','tagente_modulo','id_agente_modulo',$id_module);
|
||||
$critical_max = db_get_value('max_critical','tagente_modulo','id_agente_modulo',$id_module);
|
||||
|
||||
if ($index == 0) {
|
||||
$yellow_up = $warning_max;
|
||||
}
|
||||
else {
|
||||
if ($yellow_up != $warning_max) {
|
||||
$do_it_warning_max = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($index == 0) {
|
||||
$red_up = $critical_max;
|
||||
}
|
||||
else {
|
||||
if ($red_up != $critical_max) {
|
||||
$do_it_critical_max = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_it_warning_min || $do_it_critical_min) {
|
||||
foreach ($module_list as $index => $id_module) {
|
||||
$warning_inverse = db_get_value('warning_inverse','tagente_modulo','id_agente_modulo',$id_module);
|
||||
$critical_inverse = db_get_value('critical_inverse','tagente_modulo','id_agente_modulo',$id_module);
|
||||
|
||||
if ($index == 0) {
|
||||
$yellow_inverse = $warning_inverse;
|
||||
}
|
||||
else {
|
||||
if ($yellow_inverse != $warning_inverse) {
|
||||
$do_it_warning_inverse = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($index == 0) {
|
||||
$red_inverse = $critical_inverse;
|
||||
}
|
||||
else {
|
||||
if ($red_inverse != $critical_inverse) {
|
||||
$do_it_critical_inverse = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_it_warning_min && $do_it_warning_max && $do_it_warning_inverse) {
|
||||
$yellow_threshold = $compare_warning;
|
||||
$threshold_data['yellow_up'] = $yellow_up;
|
||||
$threshold_data['yellow_inverse'] = (bool)$yellow_inverse;
|
||||
}
|
||||
|
||||
if ($do_it_critical_min && $do_it_critical_max && $do_it_critical_inverse) {
|
||||
$red_threshold = $compare_critical;
|
||||
$threshold_data['red_up'] = $red_up;
|
||||
$threshold_data['red_inverse'] = (bool)$red_inverse;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($stacked) {
|
||||
case CUSTOM_GRAPH_AREA:
|
||||
return area_graph($flash_charts, $graph_values, $width,
|
||||
|
@ -1714,7 +1824,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, $threshold_data);
|
||||
break;
|
||||
default:
|
||||
case CUSTOM_GRAPH_STACKED_AREA:
|
||||
|
@ -1730,7 +1840,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
$title, "", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
$unit, $ttl, $homeurl, $background_color, $dashboard,
|
||||
$vconsole, $series_type, $percentil_result);
|
||||
$vconsole, $series_type, $percentil_result, $yellow_threshold, $red_threshold, $threshold_data);
|
||||
break;
|
||||
case CUSTOM_GRAPH_STACKED_LINE:
|
||||
return stacked_line_graph($flash_charts, $graph_values,
|
||||
|
|
|
@ -219,7 +219,8 @@ 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(),
|
||||
$threshold_data = array()) {
|
||||
|
||||
include_once('functions_flot.php');
|
||||
|
||||
|
@ -266,7 +267,14 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$agent_module_id,
|
||||
$font,
|
||||
$font_size,
|
||||
<<<<<<< HEAD
|
||||
$xaxisname);
|
||||
=======
|
||||
$xaxisname,
|
||||
$percentil_values,
|
||||
$threshold_data
|
||||
);
|
||||
>>>>>>> d3f5a6281... Fixed threshold in interface graphs. Ticket #156
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
|
@ -511,7 +519,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||
$dashboard = false, $vconsole = false, $series_type = array(),
|
||||
$percentil_values = array()) {
|
||||
$percentil_values = array(), $yellow_threshold = 0, $red_threshold = 0,
|
||||
$threshold_data = array()) {
|
||||
|
||||
include_once("functions_flot.php");
|
||||
|
||||
|
@ -538,8 +547,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$water_mark_url,
|
||||
$series_type,
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
$yellow_threshold,
|
||||
$red_threshold,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
|
@ -548,7 +557,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$dashboard,
|
||||
$vconsole,
|
||||
false,
|
||||
$percentil_values);
|
||||
$percentil_values,
|
||||
$threshold_data);
|
||||
}
|
||||
else {
|
||||
$graph = array();
|
||||
|
|
|
@ -116,7 +116,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(), $threshold_data = array()) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -125,7 +126,8 @@ 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,
|
||||
$threshold_data);
|
||||
}
|
||||
|
||||
function flot_line_stacked_graph($chart_data, $width, $height, $color,
|
||||
|
@ -153,7 +155,7 @@ function flot_line_simple_graph($chart_data, $width, $height, $color,
|
|||
$red_threshold = 0, $adapt_key= '', $force_integer = false,
|
||||
$series_suffix_str = '', $menu = true, $background_color = 'white',
|
||||
$dashboard = false, $vconsole = false, $agent_module_id = 0,
|
||||
$percentil_values = array()) {
|
||||
$percentil_values = array(), $threshold_data = array()) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -162,7 +164,8 @@ function flot_line_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, '', $percentil_values);
|
||||
$agent_module_id, $font, $font_size, '', $percentil_values,
|
||||
$threshold_data);
|
||||
}
|
||||
|
||||
function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
||||
|
@ -171,7 +174,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
$force_integer, $series_suffix_str = '', $menu = true,
|
||||
$background_color = 'white', $dashboard = false, $vconsole = false,
|
||||
$agent_module_id = 0, $font = '', $font_size = 7, $xaxisname = '',
|
||||
$percentil_values = array()) {
|
||||
$percentil_values = array(), $threshold_data = array()) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -202,19 +205,31 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
|
|||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||
$return .= "<p id='legend_$graph_id' class='legend_graph' style='font-size:".$font_size."pt'></p>";
|
||||
|
||||
|
||||
// Get other required module datas to draw warning and critical
|
||||
if ($agent_module_id == 0) {
|
||||
$yellow_up = 0;
|
||||
$red_up = 0;
|
||||
$yellow_inverse = false;
|
||||
$red_inverse = false;
|
||||
} else {
|
||||
$module_data = db_get_row_sql ('SELECT * FROM tagente_modulo WHERE id_agente_modulo = ' . $agent_module_id);
|
||||
$yellow_up = $module_data['max_warning'];
|
||||
$red_up = $module_data['max_critical'];
|
||||
$yellow_inverse = !($module_data['warning_inverse'] == 0);
|
||||
$red_inverse = !($module_data['critical_inverse'] == 0);
|
||||
if (!empty($threshold_data)) {
|
||||
html_debug($threshold_data, true);
|
||||
html_debug($yellow_threshold, true);
|
||||
$yellow_up = $threshold_data['yellow_up'];
|
||||
$red_up = $threshold_data['red_up'];
|
||||
$yellow_inverse = $threshold_data['yellow_inverse'];
|
||||
$red_inverse = $threshold_data['red_inverse'];
|
||||
}
|
||||
else {
|
||||
// Get other required module datas to draw warning and critical
|
||||
if ($agent_module_id == 0) {
|
||||
$yellow_up = 0;
|
||||
$red_up = 0;
|
||||
$yellow_inverse = false;
|
||||
$red_inverse = false;
|
||||
} else {
|
||||
$module_data = db_get_row_sql ('SELECT * FROM tagente_modulo WHERE id_agente_modulo = ' . $agent_module_id);
|
||||
$yellow_up = $module_data['max_warning'];
|
||||
$red_up = $module_data['max_critical'];
|
||||
$yellow_inverse = !($module_data['warning_inverse'] == 0);
|
||||
$red_inverse = !($module_data['critical_inverse'] == 0);
|
||||
html_debug($yellow_up, true);
|
||||
html_debug($yellow_threshold, true);
|
||||
html_debug($yellow_inverse, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ($menu) {
|
||||
|
|
Loading…
Reference in New Issue