Query a List of Alert Rules


  • Retrieve a list of Alert Rules, associated Metrics and the Alert Rule Creator
  • The query below excludes Global Alerts
SELECT ar.alert_rule_id As 'Alert rule ID', arei.element_id AS 'Element ID', de.name AS 'Metric name', u.username AS 'Created by'
FROM alert_rule AS ar
JOIN alert_rule_element_info AS arei ON (arei.alert_rule_id=ar.alert_rule_id)
JOIN dashboard_element AS de ON(arei.element_id=de.element_id)
JOIN user AS u ON (u.user_id=ar.user_id)
WHERE de.type='metric' AND ar.assign_type='element'
AND ar.alert_rule_type = 'user' AND ar.alert_rule_id NOT IN (SELECT alert_rule_id FROM exception_report_alert)
GROUP BY ar.alert_rule_id, arei.element_id
ORDER BY ar.alert_rule_id DESC