Add Dovecot exporter

This commit is contained in:
Fabian Stamm
2020-04-25 21:13:54 +02:00
parent a20d544b38
commit 72f45aef33
7 changed files with 96 additions and 2 deletions

Binary file not shown.

View File

@ -0,0 +1,12 @@
[Unit]
Description=Dovecot Exporter
[Service]
User=root
ExecStart=/usr/prometheus/dovecot_exporter
ProtectHome=true
ProtectSystem=full
ReadWritePaths=/var/run/dovecot/stats
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,30 @@
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
if service --status-all | grep -Fq 'dovecot_exporter'; then
service dovecot_exporter stop
fi
echo "Copying exporter"
mkdir -p /usr/prometheus
echo "Checking/Creating systemd configuration"
cp $SCRIPTPATH/dovecot_exporter /usr/prometheus/dovecot_exporter
chmod +x /usr/prometheus/dovecot_exporter
cp $SCRIPTPATH/dovecot_exporter.service /etc/systemd/system/
echo "Starting exporter"
systemctl enable dovecot_exporter.service
service dovecot_exporter start
echo "Exporter available at :9166"