Prometheus Alert Rule to Slack Template Prompt
Author Prometheus alerting rules whose labels and annotations render directly into a high-signal Slack message — required summary/runbook/dashboard fields, severity labels, and a Go template that produces a scannable Block Kit-ready payload.
- Target user
- SREs writing Prometheus alerting rules destined for Slack
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior SRE who writes Prometheus alerting rules with Slack rendering in mind, so the alert that fires is already a good message. Help me author rules and the matching Slack template.
I will provide:
- The PromQL expression(s) I want to alert on and the failure I'm catching
- Existing label conventions (service, team, env, severity)
- The Alertmanager route + Slack receiver config
- Examples of past alerts that rendered poorly in Slack
Your job:
1. **Rule structure** — write the alerting rule with a sensible `for:` duration, a `severity` label, and `team`/`service`/`env` labels for routing. Justify the `for:` choice against flappiness.
2. **Annotation contract** — populate the annotations that the Slack template depends on: `summary` (one plain-English line, no PromQL), `description` (markdown, includes a concrete first fix step), `runbook_url` (required), `dashboard_url`, and `query` (a link to the firing expression in the graph UI). Use templating like `{{ $labels.service }}` and `{{ $value | humanize }}` correctly.
3. **Severity → presentation** — map the `severity` label to the Slack color bar and emoji, and to the Alertmanager route (which channel, page vs notify).
4. **The Go template** — write the `slack_configs` title and text/Block Kit template that consumes those annotations into a scannable message: title line (emoji + alertname + service + env), key/value section (value vs threshold, since), and a context line of runbook/dashboard/query links. Handle the firing and resolved cases.
5. **Linting** — provide a CI check (promtool + a small script) that fails a PR if a rule is missing `summary`, `runbook_url`, or `severity`.
6. **Before/after** — take one of my poorly-rendered alerts and show the rewritten rule + the resulting Slack message.
Output as: (a) the alerting rule YAML with labels + annotations, (b) the Alertmanager route + slack_configs Go template, (c) the CI lint check, (d) the before/after for one alert.
Bias toward: every annotation present and justified, summaries a human can act on, and a `for:` that suppresses flapping.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Alertmanager to Slack Formatting Prompt
Design rich, scannable Slack messages for Prometheus Alertmanager alerts — severity-colored attachments, Block Kit blocks, runbook + dashboard + silence buttons, dedup, and threading.
-
Slack SLO Burn-Rate Notification Design Prompt
Design Slack notifications for SLO burn rates — multi-window multi-burn alerts, severity gradient, error-budget displays, ack workflow, and quiet-window suppression.
-
Slack Grafana Alerting Webhook Routing Prompt
Build a Grafana unified-alerting contact point that posts clean, severity-aware Slack messages with deep-linked panels, folder-based channel routing, and resolved-state updates.
-
Slack Log Error-Spike Anomaly Notifications Prompt
Design Slack notifications that detect log error-rate spikes and new error signatures, then post grouped, sampled, and actionable anomaly alerts instead of raw log noise.
More Slack prompts & error guides
Browse every Slack 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.