Skip to content

Lesson 7 of 13 · 15m

Blackbox Checks: Monitoring From the Outside

up==1 and users still down — probes for HTTP, DNS, and TLS expiry see the path your internal metrics cannot.

Your dashboards are green. Every pod is up, error rate at zero, saturation comfortable. Users in Frankfurt are getting TLS errors. Everything internal can be healthy while the outside path — DNS, the CDN edge, the load balancer's certificate, the WAF rule someone added Tuesday — is broken. Prometheus calls this the difference between whitebox and blackbox monitoring, and the blackbox side is the part most stacks skip until their first "works for us, broken for users" incident.

The blackbox exporter

The blackbox_exporter is a probe service: you hand it a module and a target, and it reports probe_success, probe_duration_seconds, probe_http_status_code, and probe_ssl_earliest_cert_expiry. You scrape it like any other target, with the probe target passed as a parameter:

- job_name: blackbox-http
  metrics_path: /probe
  params: {module: [http_2xx]}
  static_configs: [{targets: ["https://app.example.com/health"]}]
  relabel_configs:
    - source_labels: [__address__]
      target_label: __param_target
    - source_labels: [__param_target]
      target_label: instance
    - target_label: __address__
      replacement: blackbox-exporter:9115

The relabel dance looks ugly because it is: __address__ becomes the exporter while the real probe target becomes the instance label. You write it once and forget it.

Modules are stanzas in the exporter's blackbox.yml. The shipped example defines http_2xx, tcp_connect, icmp, grpc — a DNS prober is one you write yourself:

modules:
  dns:
    prober: dns
    timeout: 5s
    dns:
      query_name: "example.com"
      query_type: "A"
      valid_rcodes: [NOERROR]

What probes catch that internals never will

  • TLS expiry. probe_ssl_earliest_cert_expiry - time() < 14*24*3600 is the alert that saves you from the most embarrassing outage class in the industry. Expired certificates have taken down pieces of major providers and a long list of banks — always at organizations whose monitoring watched CPU.
  • DNS. The dns module above resolves a name and validates the answer — it catches delegation rot, stale records, and split-horizon mistakes that internal up cannot see.
  • TCP services. tcp_connect answers "can a client open this port" for databases, mail listeners, and anything that does not speak HTTP.
  • The outside path. Probe from outside your cluster and VPC. A probe from inside proves the app answers; a probe from the internet proves users can reach it. Those fail independently — that is the point.
  • SLI truth. The availability SLI is what the probe sees at the edge, not what the service thinks it did. A handler returning 200 on /health proves the health endpoint works.

A probe-failure sequence is worth reading once before it happens at 3am: probe_success drops to 0 and probe_duration_seconds collapses to a few milliseconds — that is a connection refused or a fast DNS failure. probe_success at 0 with probe_duration_seconds at the timeout is a blackhole — packets dying mid-path, a WAF dropping you, an upstream hanging. probe_http_status_code tells you where in the stack the answer changed: a 403 is a WAF/rule decision, a 502 is your LB's upstream down, a 301 you forgot is a redirect the probe did not follow. The triage reads off three series before anyone SSHes anywhere.

Where probes lie

A 30s probe interval misses a 20s outage and sees nothing regional unless you probe from several places — run a second exporter in another region or pair with an external uptime service (Healthchecks.io, Better Stack, your cloud's health checks) precisely because your vantage point is not your users'. Probe latency is the path's latency, not the app's — it includes DNS, TLS handshake, and the CDN edge, which is either a feature or a caveat depending on the question. An uptime-check SaaS and your own exporter will disagree sometimes; the answer is usually DNS or geography, exactly the class of problem internal metrics never show you.

Concrete practice

  • http_2xx probes on every public origin, cert-expiry warning at 14 days, DNS probes on the zones you own.
  • Probe from more than one vantage point.
  • up tells you the target exists. probe_success tells you a user can exist. You need both.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.