SELECT * FROM devices,sensors WHERE (devices.device_id = ? AND devices.device_id = sensors.device_id) AND sensors.sensor_current > “sensors.sensor_limit” AND sensors.sensor_class = “temperature” AND sensors.sensor_alert = 1
SELECT * FROM devices,sensors WHERE (devices.device_id = ? AND devices.device_id = sensors.device_id) AND sensors.sensor_current > “sensors.sensor_limit_warn” AND sensors.sensor_class = “temperature” AND sensors.sensor_alert = 1
For some reason both alerts are triggering even though the current temperature hasn’t exceeded either threshold. Any ideas why?
I also tried tweaking the alerts with a syslog.timestamp >= “macros.past_10m” condition but then I can’t get the alerts to trigger ever, no matter what I set the health settings to (regardless of delay/interval level).
If you don’t use backticks in the GUI it automatically adds quotes to the SQL query, and so it’s not comparing the current temperature with the limits I’ve set, but instead it’s comparing to a string.
Using backticks, the SQL query goes from:
SELECT * FROM devices,sensors WHERE (devices.device_id = ? AND devices.device_id = sensors.device_id) AND sensors.sensor_current > “sensors.sensor_limit” AND sensors.sensor_class = “temperature” AND sensors.sensor_alert = 1
To:
SELECT * FROM devices,sensors WHERE (devices.device_id = ? AND devices.device_id = sensors.device_id) AND sensors.sensor_current > sensors.sensor_limit AND sensors.sensor_class = “temperature” AND sensors.sensor_alert = 1
Sorry if this is obvious to everyone else, I’m just finding my feet with LibreNMS.