Last active
June 27, 2022 20:23
-
-
Save davaymne/3ef968256fc52351da11dc2f114c8f4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt update && apt upgrade -y | |
apt install htop git httpie jq tmux bc net-tools smartmontools -y | |
useradd -rs /bin/false monitor | |
cd /opt | |
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz | |
tar xvfz node_exporter-*.*-amd64.tar.gz && cp node_exporter-*.*-amd64/node_exporter . && chown monitor:monitor node_exporter | |
tee /etc/systemd/system/node_exporter.service <<"EOF" | |
[Unit] | |
Description=Node Exporter | |
After=network.target | |
StartLimitIntervalSec=0 | |
[Service] | |
Type=simple | |
Restart=always | |
RestartSec=1 | |
User=monitor | |
ExecStart=/opt/node_exporter | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
sudo systemctl enable --now node_exporter | |
sleep 2 | |
curl http://localhost:9100/metrics |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wget -q -O node_exporter.sh https://gist.githubusercontent.com/davaymne/3ef968256fc52351da11dc2f114c8f4e/raw/afd6749df6f4abc80bc8fa1bdff3add331848069/node_exporter.sh && chmod 777 node_exporter.sh && sudo /bin/bash node_exporter.sh