Render end-to-end previews of what an alert notification will actually look like (plain-text email, HTML email, Slack attachment JSON, raw webhook JSON) by replaying a Prometheus unit-test file's expected alerts through a live Alertmanager. Effectively a "print preview" for alerts. Use to review notification formatting/content before merging alert changes, or in CI against an ephemeral Alertmanager to produce a diffable preview artifact. Requires a reachable Alertmanager API and a promtool-style unit-test file as input. Can be made fully hermetic in CI by pointing the ephemeral Alertmanager at a skeleton config that keeps the team's real routing/grouping/inhibition rules but overrides receiver connection details, so no real notification ever leaves the runner.
Trending skills
7-day visitors to each skill page
Ships in promql-cody. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Takes the exp_alerts fixtures out of a Prometheus promtool-style unit
test file, POSTs each one to a real Alertmanager's /api/v2/alerts
endpoint, and renders what the resulting notification would look like in
several formats. It does not test routing/inhibition logic inside this
tool itself — it exercises whatever routing your target Alertmanager
instance is actually configured with, and shows you the rendered output.
alert-hysteresis/stale-alerts-analyzer, it
needs no real production history, so a fresh, disposable Alertmanager
instance is sufficient and the run is fully reproducible.exp_alerts fixtures — typically
the output of autogen-promql-tests (see that skill) with real,
filled-in labels/annotations, or a hand-written promtool test file.
Test cases whose exp_alerts is empty (asserting "does not fire") are
silently skipped — there's nothing to render for those.http://localhost:9093. For CI or local preview, run one disposably:
docker run -d -p 9093:9093 prom/alertmanager
The e2e-alertmanager-test binary itself is never hermetic on its own —
it always needs to POST to a real, reachable Alertmanager. But the
routing config that Alertmanager instance loads is entirely under your
control, and that's where every external dependency can be removed:
alertmanager.yml — the one that governs
production route: and inhibit_rules: — as the source of truth for
routing/grouping/inhibition logic. That's the logic worth exercising
in a test.smtp_smarthost,
Slack api_url, PagerDuty/webhook URLs and keys — with local, no-op
values. For example, point smtp_smarthost at a local SMTP catcher
(e.g. MailHog/smtp4dev) instead of the real relay, so the receiver
still accepts a connection and the message headers can be rendered and
diffed, but no mail actually leaves the runner.--alertmanager-url at it.With this setup, the Alertmanager under test still runs the real
routing/grouping/inhibition rules — so a routing regression still
surfaces in the diff — but delivery stops at the local catcher: no real
email, Slack message, or PagerDuty incident is ever created. That's what
makes this tool's CI output (rendered notification content, including
SMTP headers) safe to treat as a fully hermetic, deterministic artifact.
Generating and maintaining the skeleton config (importing the team's
routing tree while stripping receiver secrets) is on you — this repo
doesn't ship tooling for that merge/override step, and --alertmanager-config
(below) does not perform it either; it only enriches this tool's own
rendered output text.
Keep the skeleton config's routing tree in sync with the real one, ideally generated from it rather than hand-maintained — if it drifts, a green CI run stops guaranteeing anything about production routing.
go build -o bin/e2e-alertmanager-test ./cmd/e2e-alertmanager-test
# or: go install github.com/conallob/o11y-analysis-tools/cmd/e2e-alertmanager-test@latest
e2e-alertmanager-test [options]
| Flag | Default | Effect |
|---|---|---|
--tests | (required) | Path to the Prometheus unit-test YAML file to replay. |
--alertmanager-url | http://localhost:9093 | Alertmanager API base URL to POST alerts to. |
--alertmanager-config | "" | Optional path to alertmanager.yml — used only to enrich rendered output (e.g. smtp_from, receiver name in the routing-info footer), not to actually apply routing rules locally. |
--output | email | One of email, email-html, slack, json, full. |
--full | false | Also render the HTML body inside email/email-html output. |
--verbose | false | Print the Alertmanager URL being posted to per alert. |
# Plain-text email preview
e2e-alertmanager-test --tests=./alerts_test.yml --output=email
# Full HTML email rendering
e2e-alertmanager-test --tests=./alerts_test.yml --output=email-html --full
# Slack attachment JSON preview
e2e-alertmanager-test --tests=./alerts_test.yml --output=slack
# Everything, redirected to a diffable artifact for CI
e2e-alertmanager-test --tests=./alerts_test.yml --output=full > notifications.txt
Each test case with non-empty exp_alerts becomes one numbered "Test #N",
printing the alert name and then the rendered output in the requested
format(s), followed by a summary:
═══════════════════════════════════════════════════════════
Summary
═══════════════════════════════════════════════════════════
Total test cases: 3
Successful: 3
Failed: 0
Exit code 1 if any alert failed to POST successfully (e.g. Alertmanager
unreachable or returned non-200), 0 otherwise. Note: "successful" here
means the POST to Alertmanager succeeded, not that routing/inhibition
matched any particular expectation — this tool doesn't assert routing
outcomes, it only renders notification content.
TODO) exp_alerts exists —
if not, point the user at autogen-promql-tests first.--alertmanager-url (start a
disposable one via Docker if none is running and this is a local/CI
context). Never point this at a production Alertmanager — it really
posts alerts, and a receiver with live connection details will really
dispatch them. For CI, load the disposable instance with a skeleton
config that keeps real
routing/grouping/inhibition but swaps receiver connection details for
local no-op ones, so the run stays hermetic even though it exercises
real routing logic.--output=full to capture every rendering for a
comprehensive review, or --output=slack/--output=email-html when a
user specifically wants to review one channel's format.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
7 skills in this plugin
/alert-hysteresisQuery a live Prometheus's historical ALERTS series to statistically recommend better 'for:' hold-down durations, reducing spurious short-lived alerts and alert fatigue. Use interactively when an alert is firing too often/too briefly and needs its hysteresis tuned, or when auditing a rules file's for: values against real firing behavior. Requires a live Prometheus with sufficient ALERTS retention — not hermetic, not a CI check./autogen-promql-testsIdentify Prometheus alert/recording rules that have no promtool unit-test coverage, and scaffold true-positive/false-positive/hysteresis test-case skeletons for them. Use when bootstrapping unit tests for new or existing PromQL rules, or auditing test coverage of a rules file. Fully hermetic: reads only local rule/test YAML, no running Prometheus required./label-checkEnforce that PromQL expressions (and, optionally, alert definitions) carry a required set of labels — e.g. job, namespace, cluster — to prevent label collisions in multi-tenant Prometheus/Thanos/Cortex/Mimir setups. Use when validating rule YAML for required labels or required alert labels, interactively or as a CI gate. Fully hermetic: no network access or running Prometheus required./promql-codyOrchestrate all six o11y-analysis-tools PromQL/Alertmanager CLIs together as one workflow for a repo of Prometheus/Alertmanager rules — decide which tools are hermetic and CI-safe (promql-fmt, label-check, autogen-promql-tests, and e2e-alertmanager-test when given a skeleton Alertmanager config) versus interactive-only and judgment-assisted (alert-hysteresis, stale-alerts-analyzer), and in what order to run them end to end. Use this as the entry point whenever a user asks to format, validate, test, preview, tune, or clean up PromQL/Alertmanager rules in this repo — load it before reaching for an individual tool's skill so the right tool and the right mode (interactive vs. CI) get picked. Named after and dedicated to the late Cody Smith./promql-fmtFormat and lint PromQL expressions embedded in Prometheus/Thanos/Cortex/Mimir rule YAML files — multiline layout, redundant aggregation-clause removal, aggregation-style consistency, and naming/instrumentation best-practice checks. Use whenever writing, editing, or reviewing alert/recording rule YAML, or as a CI formatting gate on pull requests that touch rule files. Fully hermetic: no network access or running Prometheus required./stale-alerts-analyzerQuery a live Prometheus's historical ALERTS series to find alert rules that haven't fired in a long time — "dead code analysis" for alerting rules, surfacing candidates for deletion or threshold review. Use interactively during alert-quality/on-call hygiene reviews, not as a CI gate. Requires a live Prometheus with sufficient ALERTS retention./promql-cody:e2e-alertmanager-testfrom promql-cody
npx claudepluginhub conallob/o11y-analysis-tools --plugin promql-cody