Our Blog

Article2025-01-01

How to install Prometheus Blackbox Exporter

This section is a walkthrough of the installation steps for Prometheus Blackbox Exporter on Linux.

Prerequisites

Before installing Prometheus Blackbox Exporter, you need to ensure that your system meets the following requirements:

    - A Linux-based operating system (e.g., Ubuntu, CentOS, Debian)
    - A user account with sudo privileges
    - Prometheus server installed and running
    - Basic knowledge of the terminal/command line

Download Prometheus Blackbox Exporter

You can download the latest version of Prometheus Blackbox Exporter from the official Prometheus Github repository. To download the exporter, use the following command:

$ wget
https://github.com/prometheus/blackbox_exporter/releases/download/v0.19.0/blackbox_exporter-0.19.0.linux-amd64.tar.gz

This will download the tarball of the Prometheus Blackbox Exporter to your current working directory.

Extract the files

Once the download is complete, you must extract the files from the tarball and move the files to the appropriate location. We will transfer the files to /opt/blackbox_exporter. To do this, use the following command

$ tar -xvf blackbox_exporter-0.19.0.linux-amd64.tar.gz
$ sudo mv blackbox_exporter-0.19.0.linux-amd64 /opt/blackbox_exporter

Create a service file

You must create a service file to manage the Prometheus Blackbox Exporter service.

$ sudo nano /etc/systemd/system/blackbox_exporter.service

Then, add the following lines to the file.

[Unit]
Description=Prometheus Blackbox Exporter
Wants=network-online.target
After=network-online.target

[Service]
User=nobody
Group=nogroup
Type=simple
ExecStart=/opt/blackbox_exporter/blackbox_exporter

[Install]
WantedBy=multi-user.target

Restart the systemd service.

$ sudo systemctl daemon-reload

Start the Prometheus Blackbox Exporter service and enable the service to start automatically at boot time.

$ sudo systemctl start blackbox_exporter
$ sudo systemctl enable blackbox_exporter

AdminAdmin