<!-- TITLE: Blackbox Exporter Install Script --> <!-- SUBTITLE: A quick summary of Blackbox Exporter Script --> # Simple Blackbox Exporter script ```sh #!/bin/bash #Install Black_Box exporter sudo useradd --no-create-home --shell /bin/false blackbox_exporter curl -LO https://github.com/prometheus/blackbox_exporter/releases/download/v0.14.0/blackbox_exporter-0.14.0.linux-amd64.tar.gz tar xvf blackbox_exporter-0.14.0.linux-amd64.tar.gz sudo mv ./blackbox_exporter-0.14.0.linux-amd64/blackbox_exporter /usr/local/bin sudo chown blackbox_exporter:blackbox_exporter /usr/local/bin/blackbox_exporter rm -rf ~/blackbox_exporter-0.14.0.linux-amd64.tar.gz ~/blackbox_exporter-0.14.0.linux-amd64 sudo mkdir /etc/blackbox_exporter sudo chown blackbox_exporter:blackbox_exporter /etc/blackbox_exporter sudo cat <<EOF> blackbox.yml modules: http_2xx: prober: http timeout: 5s http: valid_status_codes: [] method: GET no_follow_redirects: false fail_if_ssl: false fail_if_not_ssl: false fail_if_body_not_matches_regexp: - 'Check word' EOF sudo mv blackbox.yml /etc/blackbox_exporter/ sudo chown blackbox_exporter:blackbox_exporter /etc/blackbox_exporter/blackbox.yml sudo cat <<EOF> blackbox_exporter.service [Unit] Description=Blackbox Exporter Wants=network-online.target After=network-online.target [Service] User=blackbox_exporter Group=blackbox_exporter Type=simple ExecStart=/usr/local/bin/blackbox_exporter --config.file /etc/blackbox_exporter/blackbox.yml [Install] WantedBy=multi-user.target EOF sumo mv blackbox_exporter.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl start blackbox_exporter sudo systemctl status blackbox_exporter sudo systemctl enable blackbox_exporter ```