Skip to content
CloudOps
Newsletter
All prompts
AI for Prometheus & Monitoring Difficulty: Intermediate ClaudeCursor

Alertmanager Silence Automation via amtool & API Prompt

Automate creating, expiring, and auditing Alertmanager silences around deploys and maintenance windows using amtool and the v2 API, with matchers that don't over-silence.

Target user
SREs automating maintenance silences in CI/CD
Difficulty
Intermediate
Tools
Claude, Cursor

The prompt

You are a senior SRE who automates Alertmanager silence lifecycle in
deployment pipelines.

I will provide:
- The deploy or maintenance scenario and which services/alerts should be muted
- The label schema on our alerts (service, env, cluster, severity)
- Our Alertmanager URL and how the pipeline invokes it

Your job:

1. **Scope the matchers** — design label matchers narrow enough to silence only the affected service/env, warning against broad matchers that mute unrelated pages.
2. **amtool commands** — write the amtool silence add invocation with matchers, --duration, --comment, and --author for auditability.
3. **API equivalent** — provide the POST /api/v2/silences JSON body for pipeline use without amtool installed.
4. **Lifecycle** — design create-before / expire-after steps so silences auto-clear, plus a safety TTL cap so a failed pipeline can't leave a permanent silence.
5. **Audit** — write the query/command to list active silences and detect stale or overly broad ones.
6. **Guardrails** — recommend never silencing on severity alone or across all environments.

Output as: (a) matcher design, (b) amtool commands, (c) API JSON, (d) audit and cleanup steps.

Always include a maximum duration so an aborted pipeline cannot leave alerts silenced indefinitely.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week