Created
February 24, 2020 06:12
-
-
Save shukla2112/579fe2595644e51199a51b783498d0f8 to your computer and use it in GitHub Desktop.
Install node exporter for the ubuntu machines
This file contains hidden or 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 | |
useradd -m -s /bin/bash prometheus | |
# (or adduser --disabled-password --gecos "" prometheus) | |
# Download node_exporter release from original repo | |
curl -L -O https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gz | |
tar -xzvf node_exporter-0.17.0.linux-amd64.tar.gz | |
mv node_exporter-0.17.0.linux-amd64 /home/prometheus/node_exporter | |
rm node_exporter-0.17.0.linux-amd64.tar.gz | |
chown -R prometheus:prometheus /home/prometheus/node_exporter | |
# Add node_exporter as systemd service | |
tee -a /etc/systemd/system/node_exporter.service << END | |
[Unit] | |
Description=Node Exporter | |
Wants=network-online.target | |
After=network-online.target | |
[Service] | |
User=prometheus | |
ExecStart=/home/prometheus/node_exporter/node_exporter | |
[Install] | |
WantedBy=default.target | |
END | |
systemctl daemon-reload | |
systemctl start node_exporter | |
systemctl enable node_exporter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment