Adding connectivity_exporter
This commit is contained in:
BIN
exporter/connectivity_exporter/connectivity_exporter
Normal file
BIN
exporter/connectivity_exporter/connectivity_exporter
Normal file
Binary file not shown.
10
exporter/connectivity_exporter/connectivity_exporter.service
Normal file
10
exporter/connectivity_exporter/connectivity_exporter.service
Normal 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
|
@ -0,0 +1,2 @@
|
||||
OPTIONS=""
|
||||
CONFIG="/etc/sysconfig/connectivity_exporter.yaml"
|
@ -0,0 +1 @@
|
||||
targets: []
|
50
exporter/connectivity_exporter/install.sh
Normal file
50
exporter/connectivity_exporter/install.sh
Normal 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"
|
Reference in New Issue
Block a user