prometheus: add node-exporter installer

This commit is contained in:
Schneider Roland 2024-10-26 22:24:32 +02:00
parent 995c768654
commit 9bd40e189d

View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
cd /tmp
# download archived binary
wget https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
# extract tar
tar -xvf node_exporter-1.8.2.linux-amd64.tar.gz
# cd to extracted dir
cd node_exporter-1.8.2.linux-amd64
# everybody can execute it
sudo chmod a+x node_exporter
# copy node_exporter
sudo cp node_exporter /usr/local/bin
#create a new service
sudo vim /etc/systemd/system/node_exporter.service
cat << EOF > /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target
[Service]
User=mmkb
Group=mmkb
Type=simple
ExecStart=/usr/local/bin/node_exporter
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
# enable and start service
sudo systemctl enable node_exporter
sudo systemctl start node_exporter
sudo systemctl status node_exporter.service