Adding connectivity_exporter

This commit is contained in:
Fabian Stamm
2020-04-29 15:45:24 +02:00
parent b39ca12566
commit f1872650dd
7 changed files with 99 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,10 @@
[Unit]
Description=Node Exporter
[Service]
User=connectivity_exporter
EnvironmentFile=/etc/sysconfig/connectivity_exporter
ExecStart=/usr/prometheus/connectivity_exporter --config $CONFIG $OPTIONS
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,2 @@
OPTIONS=""
CONFIG="/etc/sysconfig/connectivity_exporter.yaml"

View File

@ -0,0 +1 @@
targets: []

View File

@ -0,0 +1,50 @@
#!/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 getent passwd connectivity_exporter > /dev/null 2>&1; then
echo "User already exists!"
else
adduser --system --no-create-home --group --shell=/bin/false connectivity_exporter
fi
if service --status-all | grep -Fq 'connectivity_exporter'; then
service connectivity_exporter stop
fi
echo "Copying exporter"
mkdir -p /usr/prometheus
echo "Checking/Creating systemd configuration"
cp $SCRIPTPATH/connectivity_exporter /usr/prometheus/connectivity_exporter
chmod +x /usr/prometheus/connectivity_exporter
cp $SCRIPTPATH/connectivity_exporter.service /etc/systemd/system/
[ ! -d /etc/sysconfig ] && mkdir /etc/sysconfig
if [ -f "/etc/sysconfig/connectivity_exporter" ]; then
echo "/etc/sysconfig/connectivity_exporter already there. Skipping."
else
cp $SCRIPTPATH/connectivity_exporter.sysconfig /etc/sysconfig/connectivity_exporter
fi
if [ -f "/etc/sysconfig/connectivity_exporter.yaml" ]; then
echo "/etc/sysconfig/connectivity_exporter.yaml already there. Skipping."
else
cp $SCRIPTPATH/connectivity_exporter.yaml /etc/sysconfig/connectivity_exporter.yaml
fi
echo "Starting exporter"
systemctl enable connectivity_exporter.service
service connectivity_exporter start
echo "Exporter available at :9285"