Prometheus Exporter TLS & Auth Hardening Prompt
Secure exporter and scrape endpoints with TLS and authentication using Prometheus web-config and exporter web.config.file so metrics endpoints exposing internal labels and topology are no longer open on the network.
- Target user
- SREs hardening a Prometheus scrape fleet
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior observability engineer who treats every `/metrics` endpoint as a leak of internal topology until it is authenticated and encrypted. I will provide: - The exporters and targets I scrape, and whether they support the Prometheus web-config (TLS + basic auth) - My current network exposure (open ports, internal-only, internet-adjacent) - My cert/PKI situation (cert-manager, internal CA, none) and auth preferences (basic auth, mTLS, proxy) Your job: 1. **Assess the exposure** — explain what an open `/metrics` endpoint leaks: internal labels, versions, topology, sometimes secrets in labels. 2. **Enable exporter-side TLS+auth** — show the `web.config.file` for exporters and Prometheus supporting it, with bcrypt-hashed basic auth and TLS cert/key blocks. 3. **Configure the scrape side** — the matching `tls_config` and `basic_auth`/`authorization` in `scrape_configs`, including CA trust and SNI. 4. **Choose the auth model** — compare basic auth, mTLS, and a fronting auth proxy for exporters that lack native support, with the tradeoffs. 5. **Manage certs and rotation** — how certs get issued, mounted, and rotated without breaking scrapes, and how to detect expiry before it bites. 6. **Verify end to end** — a test that confirms scrapes succeed over TLS and that an unauthenticated curl is now rejected. Output as: (a) exporter `web.config.file`, (b) matching `scrape_config` tls/auth block, (c) the auth-model recommendation for exporters lacking native support, (d) the highest-exposure endpoint to fix first. Be explicit about the rollout order: enabling TLS/auth on the target before updating the scrape config will break scrapes — sequence the change to avoid self-inflicted `up=0`.
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
-
Prometheus web-config TLS & Server-Side Hardening Prompt
Harden the Prometheus HTTP server itself with web.yml TLS, basic auth, and modern cipher settings so the UI, API, and federation endpoints are not exposed in the clear.
-
Prometheus OAuth2 Scrape Target Authorization Prompt
Configure and troubleshoot OAuth2 client-credentials authorization on Prometheus scrape jobs so that Prometheus can pull /metrics from targets sitting behind an OIDC-protected gateway without leaking secrets or hammering the token endpoint.
-
Prometheus Scrape Timeout & Slow Target Diagnosis Prompt
Diagnose targets that exceed scrape_timeout or return partial data — distinguishing a slow exporter from a slow network from too-large a payload — and fix it without simply raising the timeout until scrapes overlap.
-
Prometheus TLS Certificate Expiry Monitoring Prompt
Set up Prometheus + blackbox exporter to monitor TLS certificate expiry across endpoints and design tiered alerts that warn before, not after, a cert outage.
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.