How to install apache_exporter on Plesk VPS
BenRoe opened this issue · 1 comments
BenRoe commented
It's not an issue, but hopefully it saves you some time and brain cells.
Note: Apache runs on port 7080 and not on 80 on a Plesk server
apache2ctl -M | grep status
// output should be: status_module (shared)
nano /etc/apache2/mods-enabled/status.conf
/etc/apache2/mods-enabled/status.conf
<Location /server-status>
SetHandler server-status
Require local
Require ip 127.0.0.1
</Location>
service apache2 restart
sudo groupadd --system prometheus
sudo useradd -s /sbin/nologin --system -g prometheus prometheus
cd /tmp
wget https://github.com/Lusitaniae/apache_exporter/releases/download/v0.11.0/apache_exporter-0.11.0.linux-amd64.tar.gz
tar xvfz apache_exporter-0.11.0.linux-amd64.tar.gz
cd apache_exporter-0.11.0.linux-amd64
mv apache_exporter /usr/local/bin/apache_exporter
chown prometheus:prometheus /usr/local/bin/apache_exporter
nano /etc/systemd/system/apache_prometheus_exporter.service
/etc/systemd/system/apache_prometheus_exporter.service
[Unit]
Description=Apache Prometheus Exporter
Wants=network-online.target
After=network.target
[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/usr/local/bin/apache_exporter \
--insecure \
--scrape_uri="http://localhost:7080/server-status/?auto" \
--telemetry.address=":9117" \
--telemetry.endpoint="/metrics"
SyslogIdentifier=prometheus_exporter_apache
Restart=always
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start apache_prometheus_exporter
systemctl status apache_prometheus_exporter
systemctl enable apache_prometheus_exporter
curl http://localhost:9117/metrics
nano /etc/prometheus/prometheus.yml
/etc/prometheus/prometheus.yml
- job_name: "apache"
static_configs:
- targets: ["localhost:9117"]
systemctl restart prometheus
Lusitaniae commented
Thanks for sharing @BenRoe
Will close it, unless you'd like to make a PR too with this information.