From edef50856951f347bb07d3b51ba0699cf34b8a53 Mon Sep 17 00:00:00 2001 From: SourceDoctor Date: Fri, 17 Apr 2020 22:56:21 +0200 Subject: [PATCH] class sensor_descr switch --- includes/polling/functions.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index f5ab7598f3..cd3c10450a 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -196,13 +196,15 @@ function record_sensor_data($device, $all_sensors) ); data_update($device, 'sensor', $tags, $fields); + $descr = $class == $sensor['sensor_descr'] ? $class : "$class {$sensor['sensor_descr']}"; + // FIXME also warn when crossing WARN level! if ($sensor['sensor_limit_low'] != '' && $prev_sensor_value > $sensor['sensor_limit_low'] && $sensor_value < $sensor['sensor_limit_low'] && $sensor['sensor_alert'] == 1) { echo 'Alerting for '.$device['hostname'].' '.$sensor['sensor_descr']."\n"; - log_event("$class under threshold: $sensor_value $unit (< {$sensor['sensor_limit_low']} $unit)", $device, $class, 4, $sensor['sensor_id']); + log_event("$descr under threshold: $sensor_value $unit (< {$sensor['sensor_limit_low']} $unit)", $device, $class, 4, $sensor['sensor_id']); } elseif ($sensor['sensor_limit'] != '' && $prev_sensor_value < $sensor['sensor_limit'] && $sensor_value > $sensor['sensor_limit'] && $sensor['sensor_alert'] == 1) { echo 'Alerting for '.$device['hostname'].' '.$sensor['sensor_descr']."\n"; - log_event("$class above threshold: $sensor_value $unit (> {$sensor['sensor_limit']} $unit)", $device, $class, 4, $sensor['sensor_id']); + log_event("$descr above threshold: $sensor_value $unit (> {$sensor['sensor_limit']} $unit)", $device, $class, 4, $sensor['sensor_id']); } if ($sensor['sensor_class'] == 'state' && $prev_sensor_value != $sensor_value) { $trans = array_column(