Write a SQL query to retrieve the top 10 most frequent alerts from a monitoring system.
Count each alert event by alert rule and return no more than 10 rules. Include only rules with at least one recorded event.
alert_rule_id, alert_name, and alert_countalert_count descending, then alert_rule_id ascending to break ties| Column | Type | Description |
|---|---|---|
| alert_rule_idPK | INT | Unique identifier for the alert rule |
| alert_name | VARCHAR(150) | Human-readable alert name |
| severity | VARCHAR(20) | Configured alert severity |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique identifier for the alert event |
| alert_rule_id | INT | Alert rule that generated the event |
| occurred_at | TIMESTAMPTZ | Time when the alert event occurred |
| source_system | VARCHAR(80) | Monitoring source that emitted the event |