Skip to content

Instantly share code, notes, and snippets.

@chriselsen
Last active June 10, 2020 17:37
Show Gist options
  • Save chriselsen/9245e3c04b49a37933d1dca207d13c6a to your computer and use it in GitHub Desktop.
Save chriselsen/9245e3c04b49a37933d1dca207d13c6a to your computer and use it in GitHub Desktop.
#!/bin/bash
cd /tmp
wget https://github.com/prometheus/node_exporter/releases/download/v1.0.0/node_exporter-1.0.0.linux-amd64.tar.gz
sudo tar xvfz node_exporter-1.0.0.linux-amd64.tar.gz
sudo mv node_exporter-1.0.0.linux-amd64 /opt/
sudo tee -a /etc/systemd/system/prometheus-node_exporter.service > /dev/null <<EOT
[Unit]
Description=Promtheus Node Exporter
Before=prometheus.service
[Service]
Type=exec
ExecStart=/opt/node_exporter-1.0.0.linux-amd64/node_exporter --web.listen-address="127.0.0.1:9100"
RestartSec=60
Restart=always
StandardOutput=journal
[Install]
WantedBy=multi-user.target
EOT
sudo systemctl enable prometheus-node_exporter
sudo systemctl start prometheus-node_exporter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment