====================================
Component | Version |
---|---|
LibreNMS | 1.40 |
DB Schema | 252 |
PHP | 7.2.2 |
MySQL | 5.5.56-MariaDB |
RRDTool | 1.4.8 |
SNMP | NET-SNMP 5.7.2 |
==================================== |
When I create a custom alert or import an alert from the collection, conditional values such as sensors.sensor_limit are treated as a literal string and cause the alert to trigger when the condition is not met.
Below is the value for the query column for the rule depicted above.
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_alert = 1 AND (devices.status = 1 && (devices.disabled = 0 && devices.ignore = 0)) = 1
If I update the query column to remove the quotes from sensor.sensor_limit, the rule works as expected.
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_alert = 1 AND (devices.status = 1 && (devices.disabled = 0 && devices.ignore = 0)) = 1