Add basic postfix_exporter

This commit is contained in:
Fabian Stamm 2020-04-26 20:02:45 +02:00
parent 72f45aef33
commit b39ca12566
3 changed files with 41 additions and 0 deletions

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 'postfix_exporter'; then
service postfix_exporter stop
fi
echo "Copying exporter"
mkdir -p /usr/prometheus
echo "Checking/Creating systemd configuration"
cp $SCRIPTPATH/postfix_exporter /usr/prometheus/postfix_exporter
chmod +x /usr/prometheus/postfix_exporter
cp $SCRIPTPATH/postfix_exporter.service /etc/systemd/system/
echo "Starting exporter"
systemctl enable postfix_exporter.service
service postfix_exporter start
echo "Exporter available at :9154"

Binary file not shown.

View File

@ -0,0 +1,11 @@
[Unit]
Description=Postfix Exporter
[Service]
User=root
ExecStart=/usr/prometheus/postfix_exporter
ProtectHome=true
ProtectSystem=full
[Install]
WantedBy=multi-user.target