Most certificate outages are not caused by a missing renewal tool but by nobody noticing that a renewal failed until clients started rejecting the connection. Prometheus with the Blackbox Exporter gives SRE and platform teams a low-cost way to watch every TLS endpoint from the outside, the way a client sees it, and to alert days or weeks before a certificate lapses. This guide covers the exporter's TLS metrics and what each one actually measures, a working scrape and module configuration, alert rules with sensible thresholds, coverage for STARTTLS and internal services, and how to prove the monitoring itself is complete. It is written for engineers who already run Prometheus and want expiry monitoring they can trust, not a dashboard that goes quiet at the worst moment.
Key takeaways
- Probe what clients see. The Blackbox Exporter connects to the endpoint and reads the certificate actually served, which catches a renewed certificate that was never deployed or reloaded.
- Know which expiry metric you alert on.
probe_ssl_earliest_cert_expiryis the earliest expiry of any certificate the server presented;probe_ssl_last_chain_expiry_timestamp_secondsreflects the verified chains. They answer different questions. - An expired certificate makes the expiry metric disappear. With verification on, a failed handshake means no TLS metrics at all, so pair the days-left alert with a
probe_successalert. - Thresholds follow renewal cadence. With public TLS validity falling towards 47 days by March 2029, a fixed 30-day warning will soon fire on every healthy certificate. Alert on a missed renewal window instead.
- Coverage is the real metric. Monitoring is only as good as its target list: reconcile probe targets against the certificate inventory and Certificate Transparency logs.
Where external probing fits among expiry signals
There are three places to read a certificate's expiry date, and mature setups use more than one. The Blackbox Exporter covers the first. See the How to build a TLS certificate inventory guide for building the list of what should be watched.
| Signal source | Example metric | What it sees | Blind spot |
|---|---|---|---|
| External TLS probe (Blackbox Exporter) | probe_ssl_earliest_cert_expiry | The certificate a client actually receives, after load balancers, CDNs and reloads | Only endpoints in its target list; nothing for certificates not served on a port |
| Issuer or controller metrics (cert-manager) | certmanager_certificate_expiration_timestamp_seconds, certmanager_certificate_ready_status | What the controller issued and whether the Certificate resource is Ready | Cannot tell whether the workload loaded the new Secret |
| File and secret scanning (for example the x509-certificate-exporter) | Per-file or per-Secret expiry series | Certificates at rest: TLS Secrets, ConfigMaps, PKCS#12 and JKS stores, kubeconfigs, node PKI | A file on disk may not be the certificate in use |
The probe is the closest to user impact, which is why it should carry the paging alert. Controller metrics are an earlier warning: cert-manager also exports certmanager_certificate_renewal_timestamp_seconds, the time renewal should happen, so a renewal that has not happened past that time is visible before the probe shows anything. See the cert-manager security guide for securing the controller itself.
The TLS metrics the Blackbox Exporter exposes
The metric names and behaviour below are taken from the exporter's source (prober/prober.go, prober/tls.go, prober/http.go and prober/crl.go) as of release 0.29.1, October 2026.
| Metric | Type and value | How it is calculated | Use it for |
|---|---|---|---|
probe_ssl_earliest_cert_expiry | Gauge, Unix seconds | The earliest NotAfter across every certificate the server presented, leaf and intermediates | Primary days-left alert; catches an expiring intermediate the server still sends |
probe_ssl_last_chain_expiry_timestamp_seconds | Gauge, Unix seconds | For each verified chain, the earliest expiry in that chain; the metric is the latest of those | Cross-signed or multi-path chains where one path expires but another stays valid |
probe_ssl_last_chain_info | Info gauge (value 1) with labels | Leaf certificate labels: fingerprint_sha256, subject, issuer, subjectalternative, serialnumber | Detecting a certificate change, wrong certificate served, unexpected issuer |
probe_tls_version_info | Info gauge with version label | Negotiated TLS version | Spotting endpoints still negotiating TLS 1.0 or 1.1 |
probe_tls_cipher_info | Info gauge | Negotiated cipher suite | Cipher policy drift |
probe_http_ssl | Gauge, 0 or 1 | Whether the final HTTP request used TLS | Catching a redirect chain that ends on plain HTTP |
probe_ssl_crl_revoked, probe_ssl_crl_stale, probe_ssl_crl_available | Gauges, 0 or 1 | Emitted only when check_revoked: true; reports whether a certificate in the chain appears on its CRL | Revocation awareness; the setting never fails the probe on its own |
Two behaviours matter for alert design. First, the TLS metrics are registered only when the probe completes a TLS connection. With the default insecure_skip_verify: false, an expired or untrusted certificate fails the handshake, probe_success drops to 0, and probe_ssl_earliest_cert_expiry is simply absent from that scrape. A days-left alert alone therefore goes silent at the exact moment the certificate expires. Second, the verified-chain metric depends on verification: if you set insecure_skip_verify: true there are no verified chains to measure.
Configuring the exporter and the scrape job
The Blackbox Exporter follows the multi-target exporter pattern: Prometheus scrapes the exporter's /probe endpoint (default port 9115) and passes the real target as the target URL parameter through relabelling. A minimal module file for TLS expiry looks like this (sample values):
1 Sample only, based on the public documentation cited. Assess it independently against the current official documentation, test outside production and back up first.
modules:
https_cert:
prober: http
timeout: 10s
http:
method: GET
fail_if_not_ssl: true
preferred_ip_protocol: ip4
tls_config:
insecure_skip_verify: false
tls_connect:
prober: tcp
timeout: 5s
tcp:
tls: true
internal_tls:
prober: tcp
timeout: 5s
tcp:
tls: true
tls_config:
ca_file: /etc/blackbox_exporter/internal-root-ca.pemThe matching Prometheus job, adapted from the exporter's README:
scrape_configs:
- job_name: blackbox_tls
metrics_path: /probe
params:
module: [https_cert]
file_sd_configs:
- files: [/etc/prometheus/targets/tls_*.yml]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115
- job_name: blackbox_exporter
static_configs:
- targets: [blackbox-exporter:9115]- Targets from files, not the job:
file_sd_configslets the certificate inventory or a CI job write the target list, so adding an endpoint does not need a Prometheus change.http_sd_configsandkubernetes_sd_configsare alternatives. - Owner labels on every target: put
team,serviceandenvlabels in the target file so alerts route to the owner without a lookup. - SNI and virtual hosts: when probing by IP address or through DNS service discovery, the HTTP prober accepts a
hostnameparameter (set via__param_hostname) that sets the Host header and TLS SNI. For TCP probes usetls_config.server_name. Without the right SNI a shared front end may serve its default certificate, and you will monitor the wrong one. - IPv4 and IPv6:
preferred_ip_protocoldefaults toip6with fallback enabled. If a host serves different certificates on each address family, probe both explicitly with two modules. - Debugging:
/probe?target=example.com&module=https_cert&debug=truereturns the probe log, including resolved address and TLS timings.
Covering non-HTTP and internal endpoints
Expiring certificates on mail relays, LDAPS, databases and message brokers cause outages just as often as web front ends, and they are less likely to be watched.
| Endpoint type | Prober and setting | Notes |
|---|---|---|
| HTTPS sites and APIs | http with fail_if_not_ssl: true | Follows redirects by default; the metrics describe the final hop |
| Implicit TLS services (LDAPS 636, IMAPS 993, SMTPS 465, Kafka or AMQP over TLS) | tcp with tls: true | Use server_name where the certificate name differs from the target |
| STARTTLS services (SMTP 25 and 587, IMAP 143) | tcp with a query_response sequence ending in starttls: true | The exporter's example file includes smtp_starttls and imap_starttls modules |
| gRPC over TLS | grpc with tls: true | Same tls_config block |
| Private PKI services | Any prober with tls_config.ca_file | Trust the internal root explicitly instead of disabling verification |
| Mutual TLS endpoints | tls_config.cert_file and key_file | The probe client certificate is itself a credential that expires: monitor it too |
Run one exporter per network zone that holds private endpoints, so the probe path matches the client path. For devices that cannot automate renewal, see Certificates for Devices That Cannot Automate.
Alert rules that stay useful as validity shrinks
The CA/Browser Forum's Ballot SC-081v3 reduces the maximum public TLS certificate validity from 398 days to 47 days in steps between March 2026 and March 2029. A static "30 days left" warning was fine for one-year certificates; on 47-day certificates renewed around day 30 it would fire for most of every certificate's life. See the Certificate Expiry Outages and 47-Day TLS Certificates Guide for the schedule and its operational effect. Let's Encrypt also ended its expiry notification emails on 4 June 2025, so teams that relied on those emails need their own signal.
groups:
- name: tls-expiry
rules:
- record: tls:cert_days_left
expr: (probe_ssl_earliest_cert_expiry - time()) / 86400
- alert: TLSCertRenewalOverdue
expr: tls:cert_days_left < 14
for: 1h
labels:
severity: ticket
annotations:
summary: "Certificate on {{ $labels.instance }} expires in {{ $value | humanize }} days"
runbook_url: "https://runbooks.example.internal/tls-renewal"
- alert: TLSCertExpiryImminent
expr: tls:cert_days_left < 3
for: 10m
labels:
severity: page
- alert: TLSProbeFailing
expr: probe_success{job="blackbox_tls"} == 0
for: 5m
labels:
severity: page
annotations:
summary: "TLS probe failing for {{ $labels.instance }} (expired, untrusted or unreachable)"
- alert: TLSCertChanged
expr: changes(probe_ssl_earliest_cert_expiry[1h]) > 0
labels:
severity: info- Set the warning just after the expected renewal point: if automation renews when about one third of the validity period remains, a certificate with clearly less than that left (for example under a quarter) has missed its renewal window. For 90-day certificates renewed at 30 days left, 14 to 20 days is a reasonable ticket threshold; review it as validity shortens. These are sample thresholds, not a standard.
- Use
forto absorb flaps: a single failed probe should not page. Theforclause holds the alert pending until the condition persists;keep_firing_forstops it resolving on one good scrape. - Treat "changed" as informational: a fingerprint or expiry change confirms a renewal deployed. An unexpected change, such as a new issuer, deserves a look.
- Test rules before shipping:
promtool test rulesruns alert rules against synthetic series, which is the cheapest way to prove the expired-certificate case pages.
Phased rollout
- Inventory first: export known endpoints from the certificate inventory, load balancer configuration and DNS into a target file with owner labels.
- Deploy one exporter and probe in debug: check a handful of targets with
debug=trueto confirm SNI, address family and trust are right before scaling. - Record, do not alert, for a week: ship the recording rule and a dashboard, sort by days left, and fix the endpoints that are already close to expiry or failing.
- Enable ticket alerts, then paging: route the overdue alert to the owning team's queue first; add the paging rules once false positives are understood.
- Add non-HTTP and private zones: STARTTLS, LDAPS, brokers and internal CAs, each with its own exporter where the network requires it.
- Close the loop with coverage checks: compare targets with the inventory and with Certificate Transparency results each week.
Rollback: alert rules and target files live in version control; reverting a rule file and reloading Prometheus (SIGHUP or /-/reload when the lifecycle API is enabled) restores the previous state. Keep the probe job running while alert changes are reverted, so history is not lost.
Small and large deployments
- Small team, tens of endpoints: a single exporter next to Prometheus, a static target file and the four rules above are enough. The main risk is the target list going stale, so put the file next to the service definitions.
- Large estate, thousands of endpoints: generate targets from inventory or service discovery, shard probing by zone, and watch the exporter's own load (probe duration and scrape timeouts). The exporter resolves DNS on every probe without caching, so a local caching resolver reduces query volume at scale, as the README advises.
- Probe interval: expiry changes slowly, so a 5 to 15 minute scrape interval for the TLS job is usually adequate and keeps load on the targets low; uptime probing can stay on its own faster job.
- When probing is not enough: certificates used only by clients (mTLS client certificates, signing certificates, workload identity certificates) are never served on a port. Use issuer metrics or file and secret scanning for those, and see the Machine Identity PKI Certificate Lifecycle Guide.
Where identity fits
Every TLS server certificate is a machine credential, and an expired one is an availability failure of that identity. The monitoring stack also holds credentials of its own: client certificates and keys in tls_config for mTLS probes, and basic auth or OAuth settings in HTTP modules. Store these as files mounted from a secrets manager (cert_file, key_file, password_file) rather than inline strings in the module file, restrict who can read the exporter configuration, and remember that the exporter's /probe endpoint will connect to any target it is given, so keep it off untrusted networks. The Prometheus Security guide covers hardening the server and exporters.
Detection and measurement
- Coverage ratio: probed endpoints divided by inventoried TLS endpoints. Target 100% for production; track the gap list by owner.
- Minimum days left across the estate:
min(tls:cert_days_left). It should stay above your renewal-overdue threshold. - Overdue renewals open: count of firing
TLSCertRenewalOverduealerts and their age. Each one is a failed automation. - Probe health: share of TLS targets with
probe_success == 0, and scrape duration close to the timeout, which hides results. - Expiry incidents: customer-visible outages caused by expired certificates per quarter; the target is zero.
- Legacy protocol endpoints:
count by (version) (probe_tls_version_info)to find TLS 1.0 and 1.1 still negotiated.
Common failure patterns
- Days-left alert with no failure alert: the expiry metric vanishes when the handshake fails, so the dashboard shows a gap instead of a red row. Always alert on
probe_successfor the TLS job. - Verification turned off to "make probes work":
insecure_skip_verify: truehides untrusted chains and removes the verified-chain metric. Trust the internal root withca_fileinstead. - Wrong certificate monitored: probing an IP or shared front end without SNI returns a default certificate that may be valid while the real one expires.
- Intermediate expiry missed: alerting on leaf-only data from another tool while the server still sends an expiring intermediate. The earliest-expiry metric covers every presented certificate.
- Stale target list: new hostnames go live without being added. The fix is generated targets plus a weekly comparison with Certificate Transparency; see the Certificate Transparency Monitoring Guide for Web Teams.
- Treating a CRL hit as a probe failure:
check_revokedonly reports; alert onprobe_ssl_crl_revoked == 1explicitly if revocation matters.
Framework mapping
| Framework | Reference | How this monitoring supports it |
|---|---|---|
| NIST SP 800-53 Rev 5 | SC-17 Public Key Infrastructure Certificates | Evidence that issued certificates are tracked through their validity period |
| NIST SP 800-53 Rev 5 | SI-4 System Monitoring; CA-7 Continuous Monitoring | Automated, continuous checking of a security-relevant state with alerting |
| NIST SP 800-53 Rev 5 | CM-8 System Component Inventory | Target lists reconciled with the component and certificate inventory |
| NIST CSF 2.0 | ID.AM-08; DE.CM-09 | Lifecycle management of certificates as assets; monitoring of runtime environments |
Practitioner checklist
- Generate probe targets from the certificate inventory, with team, service and environment labels.
- Keep
insecure_skip_verify: false; trust private roots withca_file. - Set SNI correctly with the
hostnameparameter orserver_namefor every shared front end. - Record days left from
probe_ssl_earliest_cert_expiryand alert on a missed renewal window, not a fixed 30 days. - Alert on
probe_success == 0for the TLS job so an expired certificate still pages. - Add STARTTLS, LDAPS, broker and gRPC endpoints with TCP or gRPC modules.
- Monitor the probe's own client certificates and store all probe credentials as mounted files.
- Unit-test alert rules with
promtool test rules, including the expired case. - Compare targets with Certificate Transparency results and the inventory every week.
Standards and references
- Prometheus: Blackbox Exporter configuration reference
- Prometheus: Blackbox Exporter README and Prometheus configuration
- Prometheus: Understanding and using the multi-target exporter pattern
- Prometheus: Alerting rules
- Prometheus: Unit testing for rules
- CA/Browser Forum: Ballot SC-081v3, schedule of reducing validity and data reuse periods
- Let's Encrypt: Ending support for expiration notification emails
- cert-manager: Certificate metrics collector
Related NHI Mgmt Group resources: Expired Certificate Outage Troubleshooting Guide · Certificate Expiry Outage Tabletop Scenario · ACME and Automated Certificate Management Guide · Certificate Inventory Register Template