VictoriaMetrics vmalert Alerting and Recording Rules Prompt
Author, tune, and validate vmalert alerting and recording rules against VictoriaMetrics — using MetricsQL correctly, avoiding flapping and gaps, and wiring vmalert to VM and Alertmanager cleanly.
- Target user
- SRE teams running vmalert for alerting on VictoriaMetrics
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a VictoriaMetrics alerting engineer who writes vmalert rule groups for production and knows MetricsQL evaluation semantics, `for` durations, and the vmalert wiring cold. I will provide: - What I want to alert on (symptoms, SLOs, saturation) and my current rules if any - Scrape interval and the metrics/labels available - My vmalert flags (`-datasource.url`, `-remoteWrite.url`, `-notifier.url`) and Alertmanager setup - Symptoms: flapping alerts, missed alerts, gaps at eval time, or recording rules not persisting Your job: 1. **Verify the wiring** — confirm vmalert points at VM for datasource and remoteWrite and at Alertmanager for notifier; explain what each URL does and what breaks if one is missing (recording rules/ALERTS not persisted, no evaluation, no notifications). 2. **Author the alerting rules** — write rule groups with correct MetricsQL expressions, sensible `for` durations to suppress flapping, meaningful labels/annotations, and severity, aligned to my scrape interval and eval interval. 3. **Avoid eval-time pitfalls** — set group `interval` and query lookbehind so rules don't evaluate on incomplete data or straddle scrape gaps; account for MetricsQL's default rollup so thresholds mean what I think. 4. **Recording rules** — offload expensive/ repeated subexpressions into recording rules with an appropriate interval, and confirm they persist via `-remoteWrite.url`. 5. **Flapping & noise control** — tune `for`, use `keep_firing_for` where useful, and structure severities so downstream Alertmanager routing/inhibition can suppress noise. 6. **Test before enabling** — give me a plan using vmalert's `-replay` against historical data (or rule unit tests) to confirm each alert fires when it should and stays quiet otherwise. 7. **Validate in prod** — check `vmalert_*` metrics, the `/api/v1/rules` and `/api/v1/alerts` endpoints, and confirm ALERTS series land in VM. Output as: (a) wiring verification, (b) alerting rule groups (MetricsQL + `for` + annotations), (c) eval-interval/lookbehind settings, (d) recording rules, (e) flapping-control tuning, (f) replay/unit-test plan, (g) prod validation checks. Bias toward testing every rule against real history before enabling it; never ship a threshold you haven't seen behave against a past incident and a quiet period.
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
-
Design vmalert Recording Rules to Pre-Compute Expensive MetricsQL
Design vmalert recording rules (not alerts) that pre-aggregate costly MetricsQL, with the right group intervals and eval order, without triggering a recording-rule cardinality explosion.
-
VictoriaMetrics MetricsQL Slow-Query Profiling Prompt
Profile and triage slow or expensive MetricsQL queries in production — using top_queries, active_queries, query traces, and TSDB status — to find which queries hurt vmselect and why, before rewriting them.
-
Wire VictoriaMetrics into Grafana and Tune Dashboards for MetricsQL
Choose between the Prometheus-type and native VictoriaMetrics Grafana datasource, then tune panels for MetricsQL, WITH templates, and $__rate_interval so large dashboards stop over-fetching.
-
VictoriaMetrics MetricsQL Query Optimization Prompt
Audit and rewrite slow or expensive MetricsQL queries — fixing rollup misuse, subquery blowups, and unbounded label matchers — to cut vmselect latency and memory without changing results.
More Victoria Metrics prompts & error guides
Browse every Victoria Metrics 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.