Skip to content

Instantly share code, notes, and snippets.

@mehdi89
Last active December 16, 2022 11:34
Show Gist options
  • Save mehdi89/9b6fb4811ae057292e5b1410a870b491 to your computer and use it in GitHub Desktop.
Save mehdi89/9b6fb4811ae057292e5b1410a870b491 to your computer and use it in GitHub Desktop.
Install latest node_exporter in ubuntu with one command
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
@mehdi89
Copy link
Author

mehdi89 commented Dec 16, 2022

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

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