formations/cesi/securite_entreprise/ressources/intranet-demo/provisioning/wordpress/configure_apache_exporter.sh

28 lines
658 B
Bash

#!/usr/bin/env bash
set -xe
APACHE_EXPORTER_URL=https://github.com/Lusitaniae/apache_exporter/releases/download/v0.5.0/apache_exporter-0.5.0.linux-amd64.tar.gz
[ ! -f apache_exporter.tar.gz ] && wget -O- "$APACHE_EXPORTER_URL" > apache_exporter.tar.gz
tar -xzf apache_exporter.tar.gz
mv apache_exporter-* /opt/apache_exporter
cat > /etc/systemd/system/apache_exporter.service <<EOF
[Unit]
Description=Apache Prometheus Exporter
After=network-online.target
[Service]
Type=simple
ExecStart=/opt/apache_exporter/apache_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl enable apache_exporter
systemctl start apache_exporter