Skip to content

Instantly share code, notes, and snippets.

@davaymne
Last active June 27, 2022 20:23
Show Gist options
  • Save davaymne/3ef968256fc52351da11dc2f114c8f4e to your computer and use it in GitHub Desktop.
Save davaymne/3ef968256fc52351da11dc2f114c8f4e to your computer and use it in GitHub Desktop.
#!/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
@davaymne
Copy link
Author

davaymne commented Feb 10, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment