Last active
December 16, 2022 11:34
-
-
Save mehdi89/9b6fb4811ae057292e5b1410a870b491 to your computer and use it in GitHub Desktop.
Install latest node_exporter in ubuntu with one command
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
wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz | |
tar xvzf node_exporter-*.tar.gz | |
mv node_exporter-*/node_exporter /usr/local/bin/ | |
# Create a node_exporter user | |
useradd --no-create-home --shell /bin/false node_exporter | |
# Set the ownership of the node_exporter binary to the node_exporter user | |
chown node_exporter:node_exporter /usr/local/bin/node_exporter | |
# Create a node_exporter service file | |
echo "[Unit] | |
Description=Node Exporter | |
Wants=network-online.target | |
After=network-online.target | |
[Service] | |
User=node_exporter | |
Group=node_exporter | |
Type=simple | |
ExecStart=/usr/local/bin/node_exporter | |
[Install] | |
WantedBy=multi-user.target" > /etc/systemd/system/node_exporter.service | |
# Reload the systemctl daemon | |
systemctl daemon-reload | |
# Enable the node_exporter service to start on boot | |
systemctl enable node_exporter | |
# Start the node_exporter service | |
systemctl start node_exporter | |
# See the status of the node_exporter service | |
systemctl status node_exporter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One liner to install in ubuntu:
wget https://gist.githubusercontent.com/mehdi89/9b6fb4811ae057292e5b1410a870b491/raw/install_node_exporter.sh && sudo chmod +x install_node_exporter.sh && sudo ./install_node_exporter.sh