Exporters: node, blackbox and friends

Prometheus · Practical · 10 min

Most of what you monitor (servers, databases, proxies, external URLs) can't be instrumented directly.

An exporter is a small process that collects data from something else and exposes it in Prometheus format.

  • node_exporter (port 9100) exposes Linux host metrics: CPU (node_cpu_seconds_total), memory, filesystems, disks, network. Run it on every host, not in a container that can't see the host (or mount /proc, /sys and the root filesystem).
  • blackbox_exporter (port 9115) probes endpoints from the outside over HTTP, TCP, ICMP or DNS. Prometheus scrapes /probe?target=https://example.com&module=http_2xx, and the result includes probe_success, probe_duration_seconds and certificate expiry (probe_ssl_earliest_cert_expiry).
  • Many others exist: postgres_exporter, mysqld_exporter, redis_exporter, the NGINX exporter, cloud provider exporters. Many modern tools such as Kubernetes components, etcd, Traefik and RabbitMQ expose Prometheus metrics natively.

Blackbox scrapes need a small relabeling trick: the URL to probe is passed as the target parameter while the actual scrape address is the exporter itself. The configuration below shows the standard pattern.

Prefer exporters from the official list on prometheus.io, check how many series they produce, and disable collectors you don't need.

Example

scrape_configs:
  - job_name: node
    static_configs:
      - targets: ["web1:9100", "web2:9100"]
  - job_name: blackbox-http
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
      - targets: ["https://example.com", "https://api.example.com/health"]
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target      # URL becomes ?target=...
      - source_labels: [__param_target]
        target_label: instance            # keep the URL as instance label
      - target_label: __address__
        replacement: blackbox:9115        # actually scrape the exporter
# Query: probe_success == 0   (endpoints currently failing)

Remember

  • Exporters translate other systems' data into Prometheus metrics
  • node_exporter for hosts, blackbox_exporter for probing endpoints
  • Blackbox jobs relabel the target URL into a parameter

Watch out for

  • Running node_exporter in a container without host mounts and monitoring the container instead of the host.

Check yourself

  1. What does blackbox_exporter measure?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: prometheus.io/docs/instrumenting/exporters/