Add Dovecot exporter
This commit is contained in:
parent
a20d544b38
commit
72f45aef33
6
.editorconfig
Normal file
6
.editorconfig
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
root=true
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_size = 3
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*temp/
|
43
build/build.sh
Normal file
43
build/build.sh
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||||
|
|
||||||
|
cd $SCRIPTPATH
|
||||||
|
|
||||||
|
[ -d "./temp" ] && rm -r ./temp
|
||||||
|
|
||||||
|
mkdir ./temp
|
||||||
|
|
||||||
|
cd temp
|
||||||
|
|
||||||
|
# ------------------------
|
||||||
|
# Dovecot Exporter
|
||||||
|
# ------------------------
|
||||||
|
echo "Building dovecot_exporter"
|
||||||
|
|
||||||
|
git clone https://github.com/kumina/dovecot_exporter.git dovecot_exporter
|
||||||
|
cd dovecot_exporter
|
||||||
|
|
||||||
|
go get -d ./...
|
||||||
|
go build --ldflags '-extldflags "-static"'
|
||||||
|
|
||||||
|
cp dovecot_exporter $SCRIPTPATH/../exporter/dovecot_exporter/
|
||||||
|
|
||||||
|
# ------------------------
|
||||||
|
# Postfix Exporter
|
||||||
|
# ------------------------
|
||||||
|
echo "Building postfix_exporter"
|
||||||
|
|
||||||
|
git clone https://github.com/kumina/postfix_exporter.git postfix_exporter
|
||||||
|
cd postfix_exporter
|
||||||
|
|
||||||
|
go get -d ./...
|
||||||
|
go build
|
||||||
|
|
||||||
|
cp postfix_exporter $SCRIPTPATH/../exporter/postfix_exporter/
|
||||||
|
|
||||||
|
|
||||||
|
#go get gopkg.in/yaml.v2
|
||||||
|
|
||||||
|
#go run build.go
|
||||||
|
|
BIN
exporter/dovecot_exporter/dovecot_exporter
Normal file
BIN
exporter/dovecot_exporter/dovecot_exporter
Normal file
Binary file not shown.
12
exporter/dovecot_exporter/dovecot_exporter.service
Normal file
12
exporter/dovecot_exporter/dovecot_exporter.service
Normal 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
|
30
exporter/dovecot_exporter/install.sh
Normal file
30
exporter/dovecot_exporter/install.sh
Normal 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"
|
@ -36,7 +36,9 @@ else
|
|||||||
cp $SCRIPTPATH/node_exporter.sysconfig /etc/sysconfig/node_exporter
|
cp $SCRIPTPATH/node_exporter.sysconfig /etc/sysconfig/node_exporter
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting Exporter"
|
echo "Starting exporter"
|
||||||
|
|
||||||
systemctl enable node_exporter.service
|
systemctl enable node_exporter.service
|
||||||
service node_exporter start
|
service node_exporter start
|
||||||
|
|
||||||
|
echo "Exporter available at :9100"
|
||||||
|
Loading…
Reference in New Issue
Block a user