I am trying to create an alert rule fort an eltek minpack system to tell me when the battery is draining but not when the system is on battery test. The battery test will drain the battery. So i want i rule where a rule depends on multiple sensor values
If sensor X is below -3 then alert, but not if sensor Y = 3
X = battery drain.
Y = when system is on battery test, then sensor Y will post value 3
Not through the UI, however you can write custom SQL queries which should do what you want. The data I’ve tested this with is at the bottom, these queries seem to work ok.
Create a new rule as you would normally, however where you would normally construct your rule using the builder, just select devices.hostname equals ‘IGNORETHIS’ so it wouldn’t match any device. Now, click the Advanced tab, select Override SQL ON. Now, you need to create your own query and try and paste it in, this one works for me using my data below.
SELECT * FROM devices,sensors WHERE (devices.device_id = ? AND devices.device_id = sensors.device_id) AND (sensors.sensor_oid = ".1.3.6.1.2.1.99.1.1.1.4.100721106" AND sensors.sensor_current < 13) AND EXISTS (SELECT sensors.sensor_current FROM sensors WHERE sensors.device_id=devices.device_id AND (sensors.sensor_oid = ".1.3.6.1.2.1.99.1.1.1.4.100721211" AND sensors.sensor_current != 8305));
For mine, if PSU 2 Output is less than 13 (it is, it’s 12) and PSU 2 Fan 1 1 is not equal to 8305 which it isn’t then you’ll get an alert. You can adjust that query to fit your needs, run it in a MySQL client to test it but be sure to replace ? with the device id to test and when copying your final query back to the web ui, replace the device id with ? so it will work across multiple devices.