install-prometheus-debian-12/install-blackbox.sh
Eliezer Croitoru e0bbf7e056 2
2024-06-18 16:30:15 +03:00

47 lines
977 B
Bash
Executable File

#!/usr/bin/env bash
DOWNLOAD_URL="https://github.com/prometheus/blackbox_exporter/releases/download/v0.25.0/blackbox_exporter-0.25.0.linux-amd64.tar.gz"
wget "${DOWNLOAD_URL}" -O "blackbox.tar.gz"
tar xvf blackbox.tar.gz
cd blackbox_exporter-*linux-amd64
mv blackbox_exporter /usr/local/bin
mkdir -p /etc/blackbox
mv blackbox.yml /etc/blackbox
cd -
useradd -rs /bin/false blackbox
chown blackbox:blackbox /usr/local/bin/blackbox_exporter
chown -R blackbox:blackbox /etc/blackbox/*
cat >/etc/systemd/system/blackbox.service <<EOF
[Unit]
Description=Blackbox Exporter Service
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=blackbox
Group=blackbox
ExecStart=/usr/local/bin/blackbox_exporter \
--config.file=/etc/blackbox/blackbox.yml \
--web.listen-address=":9115"
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl enable blackbox.service
systemctl start blackbox.service
systemctl status blackbox --no-pager