Vault Prometheus Monitoring & Alerting Prompt
Build a Vault observability stack on Prometheus that catches seal events, Raft instability, lease explosions, audit failures, and latency regressions before users notice.
- Target user
- Platform and SRE teams operating HashiCorp Vault
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior SRE who has been paged by a Vault cluster at 3am and has since built the alerting that would have caught it an hour earlier.
I will provide:
- Vault version, edition, node count, storage backend (integrated Raft or other), and seal type
- Our Prometheus/Alertmanager setup and how it discovers targets
- Current dashboards and alerts, if any
- Our SLOs for Vault availability and request latency, and who carries the pager
Your job:
1. **Turn metrics on correctly.** Give the `telemetry` stanza (`prometheus_retention_time`, `disable_hostname = true`) and explain that metrics come from `/v1/sys/metrics?format=prometheus`. Cover the two access options: a scrape token with a policy granting `read` on `sys/metrics`, or `telemetry { unauthenticated_metrics_access = true }` on the listener — with the security tradeoff of exposing metrics unauthenticated and how to restrict it at the network layer. Note that each node reports its own metrics and standbys emit a subset.
2. **Scrape configuration.** Provide the Prometheus job with TLS settings, per-node targets (never scrape through the load balancer — you lose per-node visibility), relabeling to keep node identity, and a sane `scrape_interval`. Add a blackbox or HTTP probe against `sys/health` and explain its status codes: active, standby, performance standby, DR secondary, sealed, and uninitialized each return a distinct HTTP code.
3. **Seal and availability signals.** Alert on `vault_core_unsealed == 0` for any node (page immediately), no node reporting active leadership, and health-probe failures. Explain why a sealed standby is a warning but a sealed cluster is a total outage, and how auto-unseal changes the expected recovery behaviour.
4. **Leadership and Raft health.** Cover `vault_raft_leader_lastcontact` (rising values mean a struggling follower or network issue), leadership-change and step-down counters, `vault_raft_storage_*` operation latencies, follower lag, and autopilot health where available. Give thresholds that distinguish a routine leader election from flapping.
5. **Lease and token growth.** Track `vault_expire_num_leases` and alert on both absolute size and rate of growth — a lease explosion is usually an app re-authenticating in a loop or a missing revocation, and it degrades the expiration manager and restart time. Add token creation rate by auth mount, and identity/entity counts if client-count licensing matters.
6. **Request latency and throughput.** Use `vault_core_handle_request` for overall request latency and per-mount barrier/storage metrics (`vault_barrier_get`, `vault_barrier_put`) to separate "Vault is slow" from "storage is slow". Define a latency SLO with a burn-rate alert rather than a fixed threshold, and include Go runtime signals (`vault_runtime_alloc_bytes`, `vault_runtime_num_goroutines`, GC pause) for saturation.
7. **Audit and security signals.** Page on audit-device failure — Vault blocks requests when it cannot write to its only device, so this is an outage precursor, not a logging nicety. Add alerts from the audit log pipeline for root-token use, policy or auth-mount changes, and sustained `permission denied` spikes, and note these come from the log stream rather than Prometheus.
8. **PKI, secret-engine, and certificate expiry.** If PKI is in use, monitor issued-cert rates and CA/intermediate expiry. Add expiry alerts for the Vault listener's own TLS certificate and for auto-unseal KMS key availability, since both fail silently until a restart.
9. **Dashboard and runbook.** Lay out a Grafana dashboard: cluster health row, per-node seal/leader state, request rate and latency, lease count, storage latency, runtime. For each alert, write a one-line runbook link with the first diagnostic command.
Output as: (a) the telemetry and listener config, (b) the Prometheus scrape job, (c) recording rules where useful, (d) alert rules in PromQL with severity, `for` duration, and rationale, (e) the dashboard panel layout, (f) an alert-to-runbook table.
Metrics endpoints can leak operational detail — do not expose them publicly. And treat an audit-device failure alert as a page, not a ticket.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Why this prompt works
Vault monitoring usually starts and stops at “is the endpoint up”, which is precisely the check that stays green through the failures that matter. This prompt is organised around the signals that lead an outage rather than confirm one: a rising vault_raft_leader_lastcontact, a lease count growing on a curve, an audit device that has begun failing writes. Each of those is visible well before users notice, and each requires knowing which metric to look at — which is why the prompt starts by getting the telemetry stanza and the scrape configuration right rather than assuming metrics already exist.
The per-node scraping instruction earns its place by preventing a specific blind spot. Pointing Prometheus at the load balancer yields metrics from whichever node answered, so seal state, leadership, and follower lag — the three things you most want per node — become unreadable noise. Pairing direct node targets with a sys/health probe and its distinct status codes for active, standby, performance standby, DR secondary, sealed, and uninitialized gives you a cluster view that distinguishes a degraded cluster from a dead one.
Treating audit-device failure as a page rather than a ticket is the sharpest opinion in the prompt, and it reflects how Vault actually behaves: with a single audit device that cannot be written to, Vault stops serving requests. Teams routinely file that alert as a logging concern and discover the coupling during the resulting outage. The same reasoning drives the lease-growth alerting — a lease explosion is almost always an application re-authenticating in a loop, and it degrades the expiration manager and every subsequent restart long before it becomes an incident with an obvious cause.
Related prompts
-
Vault Raft Cluster Sizing and Backup Prompt
Size, deploy, and back up a HashiCorp Vault cluster on Raft integrated storage — node counts and placement, listener and cluster addressing, autopilot, snapshots, and a tested restore procedure.
-
Vault Audit Device & Lease Governance Prompt
Design HashiCorp Vault audit logging, lease and TTL governance, and token lifecycle controls so secret access is fully traceable and short-lived by default.
-
Vault Lease and TTL Tuning Prompt
Diagnose and fix HashiCorp Vault lease explosion — find which mounts and clients are generating leases, right-size default and max TTLs per mount, choose batch versus service tokens, and stop unbounded lease growth safely.
-
Vault Agent Auto-Auth & Secret Templating Prompt
Design a Vault Agent deployment that authenticates workloads automatically, caches and renews tokens, and renders secrets into config files without ever hardcoding credentials.
More HashiCorp Vault prompts & error guides
Browse every HashiCorp Vault 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.