Blackbox exporter: HTTP, TCP and certificate probes without instrumenting the app

Blackbox exporter: HTTP, TCP and TLS certificate probes for Prometheus, with probe_success and an expiry alert, without touching the application.
Blackbox exporter : sondes HTTP, TCP et certificats sans instrumenter l'application

Your application passes its own health checks, yet a customer cannot log in: the certificate expired overnight, or a firewall closed port 443. The blackbox exporter covers exactly this case. It plays the part of an outside visitor and tells you whether the door opens, with nothing installed inside the application.

The facts come from the prometheus/blackbox_exporter repository (README, CONFIGURATION.md, probe source code), read on 13 November 2026. I did not run the tool for this piece: the configurations below follow the documentation but are untested. I did not record the version number or star count, so check the releases page.

This covers an open source tool, separate from Dynatrace synthetic monitoring. For the Dynatrace side, read the Synthetic Recorder and private locations. For the Prometheus side, see alerting rules tested with promtool.

The problem: watching from outside what you cannot instrument

A classic exporter exposes numbers from inside a process. That means changing or accompanying the application. Yet much of what you monitor has no such option: a third-party service, legacy software, a load balancer, a database port, a certificate.

The question then changes. You no longer ask how the service feels, but whether it is reachable, whether it answers as expected, and for how long its certificate stays valid. According to the README, the blackbox exporter probes HTTP, HTTPS, DNS, TCP, ICMP and gRPC.

How the blackbox exporter works: one probe per request

The blackbox exporter scrapes nothing by itself. Prometheus calls it on /probe with two parameters: target (what to check) and module (how to check it). The exporter runs the probe at that moment and returns metrics about that single attempt. The documentation calls this the multi-target exporter pattern.

Two practical consequences follow. Adding a target needs no redeployment of the exporter: one line in the Prometheus configuration is enough. And the probe_success metric is 1 when the probe succeeded and 0 otherwise. That is the signal to alert on.

Step 1: define the HTTP and TCP probe modules

A module defines what “success” means. Start with two: an HTTPS page that must answer 200, and a plain TLS connection test on a port.

blackbox.yml file with two modules: an http probe requiring a 200 status and HTTPS, and a tcp probe with tls enabled
  • valid_status_codes narrows the accepted codes. By default any 2xx passes.
  • fail_if_not_ssl: true fails the probe if the response is not over TLS.
  • fail_if_body_not_matches_regexp (not used here) checks that expected text appears in the page, which helps against an error page served with a 200 code.
  • prober: tcp with tls: true tests the connection and the TLS handshake without speaking HTTP.

The configuration file reloads without a restart: through SIGHUP, a POST to /-/reload, or automatically with --config.enable-auto-reload. A malformed file is not applied.

Step 2: wire the targets into Prometheus

Prometheus must hand the target address to the exporter instead of scraping the target itself. Relabeling does that: the target address becomes the target parameter, then __address__ is replaced by the real address of the exporter.

Excerpt of prometheus.yml: blackbox job with metrics_path /probe, module http_2xx and three relabel_configs rules

Keep a second job that scrapes the exporter itself on /metrics. If the exporter goes down, all your probes fall silent together, and you want to know.

Probing certificates: the case that avoids the Monday-morning incident

For a TLS probe the exporter publishes probe_ssl_earliest_cert_expiry. From its source code, the value is a Unix timestamp in seconds, so the remaining time is the difference with the current time.

Prometheus alert rules: CibleInjoignable on probe_success equal to 0 and CertificatBientotExpire on probe_ssl_earliest_cert_expiry minus time()

The 14-day threshold is an example. Make it wide enough to cover a weekend and the lead time of your renewal process. The word “earliest” matters: the value relates to the certificate in the chain that expires first, not only the server certificate.

Pitfalls to know before production

  • DNS is resolved on every probe. The README states the result is not cached. With many targets and a short interval, put a caching resolver next to the exporter.
  • IPv6 first. By default preferred_ip_protocol is ip6, with fallback to IPv4. On a network without useful IPv6, set ip4 and ip_protocol_fallback: false.
  • The probe timeout. It derives from Prometheus’ scrape_timeout, slightly reduced, and can be capped by timeout in the module. With neither, it is 120 seconds. The query probe_duration_seconds / probe_timeout_seconds shows the margin left.
  • ICMP needs privileges. On Linux: a group in net.ipv4.ping_group_range, the CAP_NET_RAW capability, or root.
  • Do not expose it. The README warns that the exporter makes requests to any target it is given. Protect it with TLS and basic authentication, and never publish it on the internet.

How to check that it works

  1. Call http://localhost:9115/probe?target=https://example.org&module=http_2xx: the response must contain probe_success 1.
  2. Add &debug=true to read the probe logs when it fails.
  3. In Prometheus, open Status then Targets: the blackbox job must be “UP”.
  4. Evaluate the certificate query: it must return a number of days consistent with the real certificate.

Good practice

  • One probe per important journey, not per server: probe the URL the user actually calls.
  • Run the exporter from several network locations to tell a local fault from a real outage.
  • Alert on the certificate well before expiry, and on probe_success with a for duration to cut noise.
  • Tie the probe to an availability SLO, as in SLOs built on telemetry.

Frequently asked questions

Does the blackbox exporter replace Dynatrace synthetic monitoring?

No, they are separate tools. The blackbox exporter checks availability and certificates, with no browsing scenario. It does not replace a multi-step test. This article covers the open source tool only.

What licence does the blackbox exporter use?

The repository’s LICENSE file is the Apache 2.0 licence.

Can you probe non-HTTP targets?

Yes: TCP, DNS, ICMP and gRPC are supported, according to the README. The TCP module also accepts a query_response exchange to check a banner.

Conclusion

When you cannot instrument a service, probe it from outside: one module, one relabeling rule, two alerts. Sources: prometheus/blackbox_exporter repository and multi-target exporter guide.

span.observer is an independent blog, not affiliated with Dynatrace LLC or the Prometheus project. Brands mentioned belong to their owners. Tools change fast: check commands and options in the official documentation.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
OpenFeature feature flags : relier traces et métriques

OpenFeature feature flags: link traces and metrics

Related Posts