Table of Contents
In this article, I will guide you to install Prometheus Blackbox exporter on Ubuntu 18. There are many articles instructing you to use blackbox exporter to monitor websites, SSL, etc. However, those articles are too long, So I will separate the blackbox exporter installation.
How to use the blackbox exporter, which grafana dashboard to use, I will guide you in the next articles.
What is Blackbox exporter?
First, when you read about prometheus, you know that prometheus uses a pull mechanism. While other tools like zabbix, for example, use the push mechanism through the agent. So the pull and push here are what to pull and what to push. It is to push or retrieve metrics of information about the system that needs to be monitored. For example: ram, disk, cpu, uptime,…
And through the pull mechanism, prometheus uses exporters. Exporters will run and call target endpoints to retrieve data. And prometheus’ job is to use these exporters to retrieve and save data into the database.
So, what is Blackbox exporter? It is an exporter program that allows calls to endpoints via HTTP, HTTPS, DNS, TCP and ICMP protocols.
This also means you can use it to monitor any endpoint, using one of the above protocols.
Install Blackbox exporter on Ubuntu 18

To determine the latest version of the blackbox exporter, visit this link.
The current latest version is v0.17.0.
We download and unzip the installation package.
wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.17.0/blackbox_exporter-0.17.0.linux-amd64.tar.gz
tar xvzf blackbox_exporter-0.17.0.linux-amd64.tar.gz && rm -f blackbox_exporter-0.17.0.linux-amd64.tar.gz
cd blackbox_exporter-0.17.0.linux-amd64Move the binary executable file to the local directory.
mv blackbox_exporter /usr/local/binCreate a config folder for the blackbox exporter.
mkdir -p /etc/blackbox
mv blackbox.yml /etc/blackboxCreate a blackbox user and assign ownership of the config folder.
useradd -rs /bin/false blackbox
chown blackbox:blackbox /usr/local/bin/blackbox_exporter
chown -R blackbox:blackbox /etc/blackbox/*Finally, we create a systemd service file for the blackbox exporter.
nano /etc/systemd/system/blackbox.serviceCopy the content below into the file.
[Unit]
Description=Blackbox Exporter Service
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=blackbox
Group=blackbox
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/blackbox_exporter \
--config.file=/etc/blackbox/blackbox.yml \
--web.listen-address=":9115"
SyslogIdentifier=blackbox
Restart=always
[Install]
WantedBy=multi-user.targetReload the daemon service, enable and start the blackbox exporter service.
systemctl daemon-reload
systemctl enable blackbox.service
systemctl start blackbox.serviceNow, to check if the service is running, type the command below.
systemctl status backboxConclusion
This article has guided you step by step to successfully install Prometheus Blackbox exporter on Ubuntu 18. In the next articles, I will show you how to use this exporter.