Grafana Alertmanager Datasource & Routing Prompt
Wire an external Alertmanager as a Grafana datasource and design its routing tree, grouping, inhibition, and silences so alerts reach the right receivers without storms.
- Target user
- SREs managing alert routing across Grafana-managed and external Alertmanager alerts
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior SRE who configures Grafana's Alertmanager integration and writes routing trees that group and dedupe alerts so on-call gets signal, not noise. I will provide: - Whether alerts come from Grafana-managed rules, an external Prometheus Alertmanager, or both - The receivers available (PagerDuty, Slack, email, webhook) and which teams own which alerts - The label schema on alerts (severity, team, cluster, namespace) Your job: 1. **Datasource / mode**: decide whether to use the built-in Grafana Alertmanager or add an external one as an `alertmanager` datasource (`implementation: prometheus` or `mimir`), and provision it as YAML with the correct `handleGrafanaManagedAlerts` setting. 2. **Routing tree**: build a `route` with a sane root (`group_by`, `group_wait`, `group_interval`, `repeat_interval`) and child routes that match on labels (`team`, `severity`) with `continue` used deliberately. 3. **Grouping**: choose `group_by` labels so related alerts collapse into one notification (e.g. by `cluster` + `alertname`) instead of one message per series. 4. **Inhibition**: write `inhibit_rules` so a `severity: critical` cluster-down alert suppresses the downstream `warning` noise it causes. 5. **Receivers**: map each route to a receiver with the right integration config, and reference secrets, never inline them. 6. **Silences & mute timings**: define `mute_time_intervals` for maintenance windows and explain silences vs mutes. 7. **Validation**: show how to `amtool` check the config and test-route a sample alert before shipping. Mark DESTRUCTIVE: none — but a wrong root `group_by` or `repeat_interval` can either flood on-call or hide real pages. --- Alert sources: [DESCRIBE] Receivers + team ownership: [DESCRIBE] Alert label schema: [DESCRIBE]
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Why this prompt works
Alert routing failures are rarely about the alert rule — they’re about grouping, repeat intervals, and inhibition in the Alertmanager config. This prompt makes the assistant reason about the label schema first, then build a routing tree with deliberate grouping and inhibition, and validate it with amtool before it ever pages a human.
How to use it
- State whether alerts are Grafana-managed, external, or both so the datasource mode is right.
- Give the label schema so
group_byand route matchers are correct. - Map receivers to teams so each route lands on the right on-call.
- Always validate with
amtoolagainst real sample alerts.
Useful commands
# Validate the Alertmanager config and simulate routing
amtool check-config alertmanager.yml
amtool config routes test --config.file=alertmanager.yml \
severity=critical team=payments
# Confirm the external Alertmanager datasource is reachable from Grafana
curl -s -H "Authorization: Bearer $GRAFANA_TOKEN" \
http://localhost:3000/api/datasources/name/Alertmanager | jq '.jsonData.implementation'
Example config
route:
receiver: default-slack
group_by: ['cluster', 'alertname']
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
routes:
- matchers: ['team = payments', 'severity = critical']
receiver: payments-pagerduty
continue: false
inhibit_rules:
- source_matchers: ['severity = critical', 'alertname = ClusterDown']
target_matchers: ['severity = warning']
equal: ['cluster']
mute_time_intervals:
- name: weekend-maintenance
time_intervals:
- weekdays: ['saturday', 'sunday']
Common findings this catches
- On-call flooded →
group_bytoo narrow or shortrepeat_interval. - Missed pages hidden in noise →
group_bytoo broad. - Double notifications → misused
continue: true. - Suppressed real alerts → inhibition
equallabels wrong. - Leaked secrets → integration keys inlined in the config.
When to escalate
- On-call tolerance and paging policy — the incident-management owner.
- External Alertmanager HA/clustering — the platform team.
- Team↔receiver ownership disputes — the alerting governance owner.
Related prompts
-
Grafana Legacy-to-Unified Alerting Migration Prompt
Plan and execute a migration from Grafana legacy dashboard alerts to unified alerting — rule translation, contact points, notification policies, and a safe rollback path.
-
Grafana SLO Burn-Rate Dashboard Design Prompt
Design a multi-window, multi-burn-rate SLO dashboard in Grafana with error-budget panels, fast/slow burn alert rules, and Prometheus recording rules.
-
Grafana Alert Rules Provisioning YAML Prompt
Provision Grafana unified alerting rules as code via /etc/grafana/provisioning/alerting so alert groups, thresholds, and notification routing are reproducible and drift-free.
-
Grafana Alert Silences and Mute Timings Prompt
Suppress Grafana alert noise during maintenance and off-hours using silences and mute timings without dropping real incidents.
More Grafana prompts & error guides
Browse every Grafana prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.