I have looked at the Database Table librenms.alert_rules
The query field for the problem rule looks as follows;
SELECT * FROM devices WHERE (devices.device_id = ?) AND ("(devices.status = 0 && "(devices.disabled = 0 && devices.ignore = 0)")") = 1
The correspsonding rule builder field looks as follows;
{"condition":"AND","rules":[{"id":"macros.device_down","field":"macros.device_down","type":"integer","input":"radio","operator":"equal","value":"1"}],"valid":true}
We manually removed the erroneous quotes the rule works correctly and the SQL Errors stop.
SELECT * FROM devices WHERE (devices.device_id = ?) AND ((devices.status = 0 && (devices.disabled = 0 && devices.ignore = 0))) = 1
I then created a new rule from the collection;
With the standard settings
The following new entry was added to the librenms.alert_rules table
Query
SELECT * FROM devices WHERE (devices.device_id = ?) AND ("(devices.status = 0 && "(devices.disabled = 0 && devices.ignore = 0)")") = 1
Builder
{"condition":"AND","rules":[{"id":"macros.device_down","field":"macros.device_down","type":"integer","input":"radio","operator":"equal","value":"1"}],"valid":true}
I have compared the builder field with our working instance and they are identical.

