Node Exporter Setup
Installing and configuring Prometheus Node Exporter for system metrics collection
Basic Installation
-
Download the latest release from the official GitHub releases page:
export VERSION=<latest_version> # Replace with the current version number wget https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.linux-amd64.tar.gz
-
Extract the tarball:
tar -xvf node_exporter-${VERSION}.linux-amd64.tar.gz
-
Move the binary to the correct location:
sudo mv node_exporter-${VERSION}.linux-amd64/node_exporter /usr/local/bin/
-
Create a system user for the node exporter:
sudo useradd -rs /bin/false node_exporter
-
Create a systemd service file:
sudo nano /etc/systemd/system/node_exporter.service
Add the following content:
[Unit] Description=Node Exporter After=network.target [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=/usr/local/bin/node_exporter [Install] WantedBy=multi-user.target
-
Enable and start the service:
sudo systemctl daemon-reload sudo systemctl enable node_exporter sudo systemctl start node_exporter
-
Verify installation:
sudo systemctl status node_exporter
Also check if the metrics endpoint is accessible:
curl http://localhost:9100/metrics
Troubleshooting
-
Service fails to start:
- Check logs:
sudo journalctl -u node_exporter
- Verify permissions: Ensure the node_exporter user has access to the binary
- Port conflicts: Make sure port 9100 is not in use by another service
- Check logs:
-
Metrics not appearing:
- Verify the exporter is running:
ps aux | grep node_exporter
- Check firewall rules: Ensure port 9100 is accessible
- Test connectivity:
curl http://localhost:9100/metrics
- Verify the exporter is running:
-
High CPU/memory usage:
- Disable unnecessary collectors to reduce resource usage
- Increase scrape interval in Prometheus configuration
Security Considerations
- Consider using a reverse proxy with TLS for secure communication
- Implement authentication if the exporter is exposed to untrusted networks
- Use firewall rules to restrict access to the metrics endpoint