2024-03-21 14:22:43 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2024-06-18 16:30:15 +03:00
|
|
|
DOWNLOAD_URL="https://github.com/prometheus/blackbox_exporter/releases/download/v0.25.0/blackbox_exporter-0.25.0.linux-amd64.tar.gz"
|
2024-03-21 14:22:43 +02:00
|
|
|
|
|
|
|
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
|