Skip to content

Instantly share code, notes, and snippets.

@rbudiharso
Last active July 1, 2021 06:54
Show Gist options
  • Save rbudiharso/446d866f7749c2f1f1c18e1e6258486d to your computer and use it in GitHub Desktop.
Save rbudiharso/446d866f7749c2f1f1c18e1e6258486d to your computer and use it in GitHub Desktop.
#!/bin/bash
# create node_exporter.service
cat > /etc/systemd/system/node_exporter.service <<END
[Unit]
Description=node_exporter service
After=network.target
[Service]
ExecStart=/usr/local/bin/node_exporter --collector.systemd
Type=simple
PIDFile=/var/run/node_exporter.pid
Restart=on-failure
[Install]
WantedBy=default.target
END
chmod 644 /etc/systemd/system/node_exporter.service
echo "============= starting node_exporter setup ============"
cd /tmp
curl -Ls -o ./node_exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.0.0/node_exporter-1.0.0.linux-amd64.tar.gz
tar xvzpf node_exporter.tar.gz --strip-components=1
chmod 755 ./node_exporter
mv ./node_exporter /usr/local/bin/node_exporter
systemctl daemon-reload
systemctl enable node_exporter.service
systemctl start node_exporter.service
echo "============= done ===================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment