31 lines
654 B
Bash
31 lines
654 B
Bash
|
#!/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"
|