mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Location based Alert Rule (#11128)
* Location base Alert Rule * travis fix
This commit is contained in:
@@ -177,6 +177,7 @@ class AlertUtil
|
||||
$query = "SELECT DISTINCT a.* FROM alert_rules a
|
||||
LEFT JOIN alert_device_map d ON a.id=d.rule_id AND (a.invert_map = 0 OR a.invert_map = 1 AND d.device_id = ?)
|
||||
LEFT JOIN alert_group_map g ON a.id=g.rule_id AND (a.invert_map = 0 OR a.invert_map = 1 AND g.group_id IN (SELECT DISTINCT device_group_id FROM device_group_device WHERE device_id = ?))
|
||||
LEFT JOIN alert_location_map l ON a.id=l.rule_id AND (a.invert_map = 0 OR a.invert_map = 1 AND l.location_id IN (SELECT DISTINCT location_id FROM devices WHERE device_id = ?))
|
||||
LEFT JOIN device_group_device dg ON g.group_id=dg.device_group_id AND dg.device_id = ?
|
||||
WHERE a.disabled = 0 AND (
|
||||
(d.device_id IS NULL AND g.group_id IS NULL)
|
||||
@@ -184,7 +185,7 @@ class AlertUtil
|
||||
OR (a.invert_map = 1 AND (d.device_id != ? OR d.device_id IS NULL) AND (dg.device_id != ? OR dg.device_id IS NULL))
|
||||
)";
|
||||
|
||||
$params = [$device_id, $device_id, $device_id, $device_id, $device_id, $device_id, $device_id];
|
||||
$params = [$device_id, $device_id, $device_id, $device_id, $device_id, $device_id, $device_id, $device_id];
|
||||
return dbFetchRows($query, $params);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user