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

View File

@ -4,3 +4,4 @@ charset = utf-8
indent_size = 3 indent_size = 3
indent_style = space indent_style = space
insert_final_newline = true insert_final_newline = true
end_of_line = lf

View File

@ -23,6 +23,7 @@ go build --ldflags '-extldflags "-static"'
cp dovecot_exporter $SCRIPTPATH/../exporter/dovecot_exporter/ cp dovecot_exporter $SCRIPTPATH/../exporter/dovecot_exporter/
cd ..
# ------------------------ # ------------------------
# Postfix Exporter # Postfix Exporter
# ------------------------ # ------------------------
@ -35,7 +36,41 @@ go get -d ./...
go build go build
cp postfix_exporter $SCRIPTPATH/../exporter/postfix_exporter/ cp postfix_exporter $SCRIPTPATH/../exporter/postfix_exporter/
cd ..
# ------------------------
# FritzBox Exporter
# ------------------------
# echo "Building fritzbox_exporter"
# git clone https://github.com/ndecker/fritzbox_exporter.git fritzbox_exporter
# cd fritzbox_exporter
# rm -r vendor
# go get -d ./...
# go build
# cp fritzbox_exporter $SCRIPTPATH/../exporter/fritzbox_exporter/
# cd ..
# ------------------------
# FritzBox Exporter
# ------------------------
echo "Building connectivity_exporter"
git clone https://git.stamm.me/Ops/ConnectivityExporter.git connectivity_exporter
cd connectivity_exporter
npm install
npm run build
cp connectivity-exporter $SCRIPTPATH/../exporter/connectivity_exporter/connectivity_exporter
cd ..
#go get gopkg.in/yaml.v2 #go get gopkg.in/yaml.v2

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"