Alert rule sensor dependancy

Hello

I need some help with a rule.

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

Any help?

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.

*************************** 225. row ***************************
                sensor_id: 260
           sensor_deleted: 0
             sensor_class: voltage
                device_id: 29
              poller_type: snmp
               sensor_oid: .1.3.6.1.2.1.99.1.1.1.4.100721106
             sensor_index: 100721106
              sensor_type: entity-sensor
             sensor_descr: PSU 2 Output 
                    group: PSUs
           sensor_divisor: 100
        sensor_multiplier: 1
           sensor_current: 12
             sensor_limit: 13.8
        sensor_limit_warn: NULL
         sensor_limit_low: 10.2
    sensor_limit_low_warn: NULL
             sensor_alert: 1
            sensor_custom: No
         entPhysicalIndex: 100721106
entPhysicalIndex_measured: NULL
               lastupdate: 2022-02-17 21:38:18
              sensor_prev: NULL
                user_func: NULL
*************************** 226. row ***************************
                sensor_id: 261
           sensor_deleted: 0
             sensor_class: fanspeed
                device_id: 29
              poller_type: snmp
               sensor_oid: .1.3.6.1.2.1.99.1.1.1.4.100721211
             sensor_index: 100721211
              sensor_type: entity-sensor
             sensor_descr: PSU 2 Fan 1  1
                    group: PSUs
           sensor_divisor: 1
        sensor_multiplier: 1
           sensor_current: 8304
             sensor_limit: 14947.2
        sensor_limit_warn: NULL
         sensor_limit_low: 6643.2
    sensor_limit_low_warn: NULL
             sensor_alert: 1
            sensor_custom: No
         entPhysicalIndex: 100721211
entPhysicalIndex_measured: NULL
               lastupdate: 2022-02-17 21:38:18
              sensor_prev: NULL
                user_func: NULL

Thank you. I will try it out!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.