The Blackbox exporter can perform ICMP probes. Let's see how.

First download and run the blackbox_exporter:

tar -xzf blackbox_exporter-*.linux-amd64.tar.gz
cd blackbox_exporter-*
sudo ./blackbox_exporter

sudo is used here as ICMP typically requires raw socket access, and running as root is one way to provide the necessary privileges.

If you visit :9115/probe?module=icmp&target=localhost the probe will be performed, and should include probe_success 1 indicating that it works. You can replace the target with any other hostname that you wish to probe.

Prometheus can use the Blackbox exporter to do ICMP probes against many targets with a little relabelling in your prometheus.yml:

  - job_name: 'blackbox'
    metrics_path: /probe
      module: [icmp]
      - targets:
        - localhost
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement:  # This is your blackbox exporter.

Here the usual target address become URL parameters to your blackbox exporter.


If you don't have a working IPv6 setup you may find that some targets can't be probed as the blackbox exporter prefers using an IPv6 address if there is one available. If you add &debug=true to the URL there'll be an error message like "sendto: cannot assign requested address" in this case. To handle this you can create a module that prefers IPv4 in your blackbox.yml:

   prober: icmp
     preferred_ip_protocol: ip4

And then use the icmp_ipv4 module.


Wondering how to use blackbox monitoring with Prometheus? Contact us.