commit ccb446eec5cb53d4433e83dfb927da626259ee74 Author: Fabian Stamm Date: Sat Apr 25 19:18:49 2020 +0200 First Commit diff --git a/exporter/node_exporter/install.sh b/exporter/node_exporter/install.sh new file mode 100644 index 0000000..a38f0a4 --- /dev/null +++ b/exporter/node_exporter/install.sh @@ -0,0 +1,34 @@ +#!/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 node_exporter > /dev/null 2>&1; then + echo "User already exists!" +else + adduser --system --no-create-home --group --shell=/bin/false node_exporter +fi + +if service --status-all | grep -Fq 'node_exporter'; then + service node_exporter stop +fi + +cp node_exporter /usr/prometheus/node_exporter +chmod +x /usr/prometheus/node_exporter + +cp $SCRIPTPATH/node_exporter.service /etc/systemd/system/ + +[ ! -d /etc/sysconfig ] && mkdir /etc/sysconfig + +if [ -f "/etc/sysconfig/node_exporter" ]; then + echo "/etc/sysconfig/node_exporter already there. Skipping." +else + cp $SCRIPTPATH/node_exporter.sysconfig /etc/sysconfig/node_exporter +fi + +systemctl enable node_exporter.service +systemd start node_exporter \ No newline at end of file diff --git a/exporter/node_exporter/node_exporter b/exporter/node_exporter/node_exporter new file mode 100644 index 0000000..0accb76 Binary files /dev/null and b/exporter/node_exporter/node_exporter differ diff --git a/exporter/node_exporter/node_exporter.service b/exporter/node_exporter/node_exporter.service new file mode 100644 index 0000000..b58dcda --- /dev/null +++ b/exporter/node_exporter/node_exporter.service @@ -0,0 +1,10 @@ +[Unit] +Description=Node Exporter + +[Service] +User=node_exporter +EnvironmentFile=/etc/sysconfig/node_exporter +ExecStart=/usr/prometheus/node_exporter $OPTIONS + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/exporter/node_exporter/node_exporter.sysconfig b/exporter/node_exporter/node_exporter.sysconfig new file mode 100644 index 0000000..3862744 --- /dev/null +++ b/exporter/node_exporter/node_exporter.sysconfig @@ -0,0 +1 @@ +OPTIONS="" \ No newline at end of file