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.
- Target user
- SREs and platform teams preventing certificate-expiry outages
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are an SRE who has been paged at 3am for an expired TLS certificate and has since built bulletproof cert-expiry monitoring so it never happens again. I will provide: - The endpoints I need to watch (public URLs, internal services, mTLS backends) - Whether I already run blackbox exporter and Prometheus - My alerting destination and who owns cert renewal - Any cert sources (Let's Encrypt/cert-manager, internal CA, manual) Your job: 1. **Confirm the metric source** — explain that blackbox exporter's `http` and `tcp` probes expose `probe_ssl_earliest_cert_expiry` (a unix timestamp). Make sure I know which probe module fits HTTPS vs raw TLS vs mTLS. 2. **Blackbox config** — give a `blackbox.yml` with an `http_2xx` module (and a `tcp_tls` module for non-HTTP TLS), including `tls_config` for internal CAs and SNI handling. 3. **Scrape config** — write the Prometheus `blackbox` job using the `__param_target` relabel pattern so I can list targets cleanly; show how to add targets via file_sd. 4. **Expiry PromQL** — give the query for days-until-expiry: `(probe_ssl_earliest_cert_expiry - time()) / 86400`. Explain it plainly. 5. **Tiered alerts** — write alert rules: warning at 21 days, high at 7 days, critical at 2 days. Include `for:` durations and good annotations (which endpoint, days left, who renews). 6. **Probe-failure alert** — add an alert for `probe_success == 0` so a down endpoint (which also stops expiry data) doesn't silently hide an expiring cert. 7. **Chain-aware note** — explain that `earliest_cert_expiry` reflects the soonest-expiring cert in the chain (often an intermediate), and why that's actually what you want. 8. **Validation** — how to test: point at `badssl.com` expired/short-lived endpoints, confirm each tier fires, confirm a 404 endpoint still reports expiry. Output as: (a) blackbox.yml modules, (b) Prometheus scrape job + file_sd example, (c) the expiry PromQL, (d) the tiered alert rule YAML, (e) the probe-failure rule, (f) a test plan with public endpoints. Keep it beginner-friendly: explain each relabel step and never assume I already know the blackbox target pattern.
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 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.
-
Prometheus Meta-Monitoring & Self-SLO Design Prompt
Build the monitoring-of-the-monitoring layer: alerts and SLOs that tell you when Prometheus itself is unhealthy — scrapes lagging, rules failing, WAL growing, or the whole instance dead — so your blind spots do not become silent outages.
-
Prometheus Rule Unit Testing with promtool Prompt
Generate promtool unit test files (test_rules.yml) that assert alert firing, recording-rule output, and label propagation for Prometheus rule groups in CI.
-
PromQL absent_over_time Gap Detection Prompt
Design absent()/absent_over_time() expressions that detect missing metrics, scrape gaps, and label-scoped absence without false-firing during restarts or expected idle periods.
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.