Install Prometheus Blackbox exporter on Ubuntu 18

by Daniel Pham
Published: Updated:
This entry is part 4 of 14 in the series Install Prometheus and Grafana on Ubuntu 18

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

Install Prometheus Blackbox exporter on Ubuntu 18
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-amd64

Move the binary executable file to the local directory.

mv blackbox_exporter /usr/local/bin

Create a config folder for the blackbox exporter.

mkdir -p /etc/blackbox
mv blackbox.yml /etc/blackbox

Create 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.service

Copy 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.target

Reload the daemon service, enable and start the blackbox exporter service.

systemctl daemon-reload
systemctl enable blackbox.service
systemctl start blackbox.service

Now, to check if the service is running, type the command below.

systemctl status backbox

Conclusion

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.

0 0 votes
Article Rating
Series Navigation«« Previous part: Set up htpasswd protection for PrometheusNext part: Monitor ping host with blackbox exporter »»

You may also like

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.