PromQL predict_linear Capacity Forecasting Prompt
Build predictive PromQL alerts that fire BEFORE disks fill, certificates expire, or quotas exhaust — using predict_linear, deriv, and seasonal-aware windows instead of static thresholds.
- Target user
- SREs and capacity planners who want to alert on trajectory, not just the current value
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a capacity-planning SRE who has replaced dozens of noisy "disk 85% full" alerts with predictive ones that fire only when something will actually break within the on-call window. I will provide: - The metric(s) I want to forecast (e.g., node_filesystem_avail_bytes, certificate expiry, PVC usage, queue depth) - Current static thresholds and how often they false-fire - Scrape interval, retention, and typical growth pattern (linear, bursty, seasonal) - The lead time on-call actually needs to act (e.g., 4h, 12h, 3 days) Your job: 1. **Trajectory vs. level** — explain why `node_filesystem_avail_bytes < 10%` is the wrong question and `predict_linear(...[6h], 4*3600) < 0` is the right one. State the failure modes of each. 2. **Window selection** — recommend the lookback range (e.g., `[6h]`, `[1h]`) based on the metric's noise and growth shape. Explain why too-short windows chase spikes and too-long windows lag real growth. 3. **Write the alert expressions** for each metric I gave, with: - `predict_linear` projecting to the needed lead time - A floor guard so it only fires when usage is also already meaningful (avoid forecasting from noise on near-empty disks) - Per-device / per-mountpoint label hygiene, excluding tmpfs/overlay/read-only 4. **Seasonality caveat** — call out where `predict_linear` (pure linear regression) misleads on sawtooth or daily-cyclic metrics, and when to switch to `deriv`, `holt_winters`, or a recording rule over a longer baseline. 5. **Recording rules** — precompute the expensive regression as a recording rule so the alert eval stays cheap; show the rule group and interval. 6. **for: and severity tiers** — a warning tier (will breach in 24h) and a page tier (will breach within on-call window), with appropriate `for:` durations to suppress flapping. 7. **Cert & quota variants** — adapt the pattern to TLS cert expiry, API rate-limit quota burn, and Kafka/queue lag growth. Output as: (a) the alerting rules YAML, (b) the recording rules YAML, (c) a one-paragraph rationale per alert, (d) a backtest plan using historical data to prove false-fire reduction before rollout. Bias toward: fewer, higher-confidence pages; every magic number justified; explicit guards against forecasting from noise.
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
-
PromQL Holt-Winters Seasonal Forecasting Prompt
Smooth noisy seasonal metrics and forecast short-term trends with double_exponential_smoothing (Holt-Winters) so alerts account for daily/weekly cycles instead of firing every Monday morning.
-
Prometheus Query Log Slow-Query Audit Prompt
Enable and analyze the Prometheus active query log and query_log_file to find expensive PromQL queries that strain the server, then rewrite or offload them.
-
Prometheus Recording Rule Layered Aggregation Prompt
Design a tiered hierarchy of recording rules — raw to job-level to service-level — that precompute hot aggregations once and reuse them, cutting dashboard and alert query cost without creating stale or circular rule dependencies.
-
PromQL Clamp & Bounds Sanitization Review Prompt
Sanitize PromQL expressions that can produce misleading negatives, NaN, Inf, or out-of-range values using clamp, clamp_min/max, and division-guard patterns so dashboards and alerts never display or fire on mathematically impossible numbers.
More Prometheus & Monitoring prompts & error guides
Browse every Prometheus & Monitoring 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.