forked from petarnikolovski/prometheus-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blackbox.sh
executable file
·29 lines (22 loc) · 1.18 KB
/
blackbox.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Make blackbox_exporter user
sudo adduser --no-create-home --disabled-login --shell /bin/false --gecos "Blackbox Exporter User" blackbox_exporter
# Make directories and dummy files necessary for blackbox exporter
sudo mkdir /etc/blackbox
sudo touch /etc/blackbox/blackbox.yml
sudo chown -R blackbox_exporter:blackbox_exporter /etc/blackbox
# Download blackbox_exporter and copy utilities to where they should be in the filesystem
wget https://github.com/prometheus/blackbox_exporter/releases/download/v0.11.0/blackbox_exporter-0.11.0.linux-amd64.tar.gz
tar xvzf blackbox_exporter-0.11.0.linux-amd64.tar.gz
sudo cp blackbox_exporter-0.11.0.linux-amd64/blackbox_exporter /usr/local/bin/
sudo chown blackbox_exporter:blackbox_exporter /usr/local/bin/blackbox_exporter
# Populate configuration files
cat ./blackbox/blackbox.yml | sudo tee /etc/blackbox/blackbox.yml
cat ./blackbox/blackbox_exporter.service | sudo tee /etc/systemd/system/blackbox_exporter.service
# systemd
sudo systemctl daemon-reload
sudo systemctl enable blackbox_exporter
sudo systemctl start blackbox_exporter
# Installation cleanup
rm blackbox_exporter-0.11.0.linux-amd64.tar.gz
rm -rf blackbox_exporter-0.11.0.linux-amd64