Added thresholds to comb/interface graphs

This commit is contained in:
fbsanchez 2018-08-09 16:33:29 +02:00
parent 367a1e121f
commit 6142fa1b05
2 changed files with 27 additions and 12 deletions

View File

@ -1704,14 +1704,16 @@ function graphic_combined_module (
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;
$threshold_data['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;
$threshold_data['red_threshold'] = $compare_critical;
$threshold_data['red_up'] = $red_up;
$threshold_data['red_inverse'] = (bool)$red_inverse;
}
$params['threshold_data'] = $threshold_data;

View File

@ -141,10 +141,21 @@ function flot_area_graph (
}
if(isset($params['graph_combined']) && $params['graph_combined'] &&
(!isset($params['from_interface']) || !$params['from_interface']) ){
$yellow_up = 0;
$red_up = 0;
$yellow_inverse = false;
$red_inverse = false;
if( isset($params['threshold_data']) && is_array($params['threshold_data'])){
$yellow_threshold = $params['threshold_data']['yellow_threshold'];
$red_threshold = $params['threshold_data']['red_threshold'];
$yellow_up = $params['threshold_data']['yellow_up'];
$red_up = $params['threshold_data']['red_up'];
$yellow_inverse = $params['threshold_data']['yellow_inverse'];
$red_inverse = $params['threshold_data']['red_inverse'];
}
else{
$yellow_up = 0;
$red_up = 0;
$yellow_inverse = false;
$red_inverse = false;
}
}
elseif(!isset($params['combined']) || !$params['combined']){
$yellow_threshold = $data_module_graph['w_min'];
@ -164,10 +175,12 @@ function flot_area_graph (
}
elseif(isset($params['from_interface']) && $params['from_interface']){
if( isset($params['threshold_data']) && is_array($params['threshold_data'])){
$yellow_up = $params['threshold_data']['yellow_up'];
$red_up = $params['threshold_data']['red_up'];
$yellow_inverse = $params['threshold_data']['yellow_inverse'];
$red_inverse = $params['threshold_data']['red_inverse'];
$yellow_threshold = $params['threshold_data']['yellow_threshold'];
$red_threshold = $params['threshold_data']['red_threshold'];
$yellow_up = $params['threshold_data']['yellow_up'];
$red_up = $params['threshold_data']['red_up'];
$yellow_inverse = $params['threshold_data']['yellow_inverse'];
$red_inverse = $params['threshold_data']['red_inverse'];
}
else{
$yellow_up = 0;