summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGeorg2021-07-25 22:30:42 +0200
committerGeorg2021-07-25 22:30:42 +0200
commitd5c1dc1bc35414d8b2dc1217c39478db4484d419 (patch)
tree7a657d1993ef3c1d734d5d97be26b39ddaaf0f0f /scripts
parent34db3400cfa92e5922dddc992871a3c0d44c2704 (diff)
downloadsystem-d5c1dc1bc35414d8b2dc1217c39478db4484d419.tar.gz
system-d5c1dc1bc35414d8b2dc1217c39478db4484d419.tar.bz2
system-d5c1dc1bc35414d8b2dc1217c39478db4484d419.zip
node_exporter script
Signed-off-by: Georg <georg@lysergic.dev>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sh/deploy_node_exporter.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/sh/deploy_node_exporter.sh b/scripts/sh/deploy_node_exporter.sh
new file mode 100755
index 0000000..52dbc7f
--- /dev/null
+++ b/scripts/sh/deploy_node_exporter.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+if [ -d /etc/systemd/system ]
+then
+if [ ! -d /opt/node_exporter ]
+then
+groupadd -g 501 prometheus
+useradd -rd /opt/node_exporter -g 501 -u 501 -s /bin/false node_exporter
+mkdir /opt/node_exporter
+curl -Lo /opt/node_exporter/LICENSE 192.168.0.120/opt/node_exporter/LICENSE
+curl -Lo /opt/node_exporter/NOTICE 192.168.0.120/opt/node_exporter/NOTICE
+curl -Lo /opt/node_exporter/node_exporter 192.168.0.120/opt/node_exporter/node_exporter
+chmod +x /opt/node_exporter/node_exporter
+chown -R node_exporter:prometheus /opt/node_exporter
+chmod 750 /opt/node_exporter
+cat <<'EOF' >/etc/systemd/system/node_exporter.service
+[Unit]
+Description=Prometheus Node Exporter
+After=network.target
+
+[Service]
+User=node_exporter
+Group=prometheus
+Type=simple
+ExecStart=/opt/node_exporter/node_exporter --web.listen-address=":9200"
+
+[Install]
+WantedBy=multi-user.target
+EOF
+systemctl enable --now node_exporter
+echo "OK"
+else
+echo "Found traces of an existing installation. Aborted."
+fi
+else
+echo "Not compatible with this system. No systemd?"
+fi