Prom-Verifier is a CLI tool designed to "Time Travel" and verify your Prometheus alerting rules against historical data.
It allows Site Reliability Engineers (SREs) to replay alert logic against past metrics to ensure that new alerts would have fired correctly (or to debug why an alert didn't fire), without needing to wait for a real outage.
- 🕰️ Time Travel Mode: Verify alerts at any specific point in the past (e.g., "What would this alert have done last Tuesday at 2 PM?").
- 🛡️ Safety First: Built-in guardrails prevent querying data older than 3 months or requesting massive windows (>4h) that could crash your Prometheus instance.
- 📝 Annotation Template Rendering: Automatically renders alert annotations (e.g.,
{{ $labels.foo }}) so you can see exactly how the alert message will look when it fires. - developer-friendly: Helps developers verify if their alerts work and preview how the rendered message will look, all before deploying to production.
If your infrastructure team has sealed off access (e.g., restricted VPC, VPN only, or internal-only Ingress),
prom-verifierwill fail to fetch the historical data.
# Clone the repository
git clone https://github.com/kooltuoehias/prom-verifier.git
cd prom-verifier
# Build the binary
go build -o prom-verifier ./cmd/prom-verifierBy default, the tool looks for an alert.yaml file in the current directory and connects to localhost:9090.
./prom-verifierBacktest a rule file against data from a specific date with a 15-minute window:
./prom-verifier \
-url "http://prometheus.prod.svc:9090" \
-file "my-alerts.yaml" \
-at "2023-11-20 14:30" \
-window "15m"| Flag | Description | Default |
|---|---|---|
-file |
Path to the alert rule file (YAML format) | alert.yaml |
-output |
Output format (text, json, yaml) |
text |
-url |
Prometheus API URL | http://localhost:9090 |
-at |
Target timestamp (YYYY-MM-DD HH:MM) for backtesting. |
Now |
-window |
Time window size to fetch data for (max 4h). |
30m |
This project follows the Standard Go Project Layout:
cmd/prom-verifier: Main entry point.internal/config: Configuration parsing, flag handling, and input validation.internal/client: Prometheus API client wrapper.internal/engine: Core domain logic (Alert evaluation, Pending vs Firing state calculation).
MIT