Added threshold graph to interface monitors graph (Only when monitors have the same warning or critical min value). Ticket #4113
This commit is contained in:
parent
e51c6cc073
commit
2391e7ae78
|
@ -164,7 +164,7 @@ 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, $percentil = null) {
|
||||
$dashboard = false, $vconsole = false, $percentil = null, $from_interface = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -245,7 +245,8 @@ function custom_graphs_print($id_graph, $height, $width, $period,
|
|||
$labels,
|
||||
$dashboard,
|
||||
$vconsole,
|
||||
$percentil);
|
||||
$percentil,
|
||||
$from_interface);
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
|
|
@ -994,7 +994,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;
|
||||
|
@ -1833,6 +1833,44 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
'color' => COL_GRAPH13,
|
||||
'alpha' => CHART_DEFAULT_ALPHA);
|
||||
|
||||
$yellow_threshold = 0;
|
||||
$red_threshold = 0;
|
||||
if ($from_interface) {
|
||||
$compare_warning = 0;
|
||||
$compare_critical = 0;
|
||||
$do_it_warning = true;
|
||||
$do_it_critical = true;
|
||||
foreach ($module_list as $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 ($compare_warning == 0) {
|
||||
$compare_warning = $warning_min;
|
||||
}
|
||||
else {
|
||||
if ($compare_warning != $warning_min) {
|
||||
$do_it_warning = false;
|
||||
}
|
||||
}
|
||||
if ($compare_critical == 0) {
|
||||
$compare_critical = $critical_min;
|
||||
}
|
||||
else {
|
||||
if ($compare_warning != $warning_min) {
|
||||
$do_it_critical = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_it_warning) {
|
||||
$yellow_threshold = $compare_warning;
|
||||
}
|
||||
|
||||
if ($do_it_critical) {
|
||||
$red_threshold = $compare_critical;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($stacked) {
|
||||
case CUSTOM_GRAPH_AREA:
|
||||
return area_graph($flash_charts, $graph_values, $width,
|
||||
|
@ -1856,7 +1894,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);
|
||||
break;
|
||||
case CUSTOM_GRAPH_STACKED_LINE:
|
||||
return stacked_line_graph($flash_charts, $graph_values,
|
||||
|
|
|
@ -511,7 +511,7 @@ 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) {
|
||||
|
||||
include_once("functions_flot.php");
|
||||
|
||||
|
@ -538,8 +538,8 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color,
|
|||
$water_mark_url,
|
||||
$series_type,
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
$yellow_threshold,
|
||||
$red_threshold,
|
||||
'',
|
||||
false,
|
||||
'',
|
||||
|
|
|
@ -187,7 +187,8 @@ $interface_traffic_modules = array(
|
|||
1,
|
||||
false,
|
||||
false,
|
||||
(($show_percentil_95)? 95 : null));
|
||||
(($show_percentil_95)? 95 : null),
|
||||
true);
|
||||
|
||||
echo '</div>';
|
||||
|
||||
|
|
Loading…
Reference in New Issue