Table of Contents
In this article, I will guide you to monitor host ping with blackbox exporter. Monitoring host/website up or down through checking ping is quite useful.
You can use ICMP ping to check any type of host: website, server, firewall, switch, camera,…
Recommended Reading: Install Prometheus Blackbox exporter on Ubuntu 18
Set up Prometheus using Blackbox exporter
First, open the prometheus configuration file.
nano /etc/prometheus/prometheus.ymlThen, add the following content to the end of the prometheus.yml file. Please note that the use of spaces must comply with the yml file format.
- job_name: 'blackbox_ping'
metrics_path: /probe
params:
module: [icmp]
static_configs:
- targets:
- 8.8.8.8
- host.example.com
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115Save the file and reload prometheus.
service prometheus reloadNow, you access the prometheus domain, go to the menu Status -> Targets. If you look at the job blackbox_ping section, the endpoints are all UP, which means it was successful.

Recommended Reading: Set up nginx proxy for Prometheus and Grafana.
Set up data sources for Grafana
This part is quite simple, you log in to the Grafana domain.
In the left menu, select Configuration -> Data Sources. Next, choose the data source type as Prometheus.
Enter the prometheus database address (http://localhost:9090) in the URL box as shown below and click Save & Test.

Set up the Grafana monitor ping dashboard
Now it’s time to use the grafana dashboard. In the left menu, click the create dashboard button (+) and select Import.
You enter the dashboard ID 12412 and click Load.

In the next window, in the localhost section at the bottom, select data source prometheus and click Import to finish.
Conclusion
With this article, I have guided you step by step to monitor host ping using Blackbox exporter. From setting up the prometheus configuration to setting up the grafana dashboard.