Node Exporter Setup

Installing and configuring Prometheus Node Exporter for system metrics collection

Basic Installation

  1. 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
    
  2. Extract the tarball:

    tar -xvf node_exporter-${VERSION}.linux-amd64.tar.gz
    
  3. Move the binary to the correct location:

    sudo mv node_exporter-${VERSION}.linux-amd64/node_exporter /usr/local/bin/
    
  4. Create a system user for the node exporter:

    sudo useradd -rs /bin/false node_exporter
    
  5. 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
    
  6. Enable and start the service:

    sudo systemctl daemon-reload
    sudo systemctl enable node_exporter
    sudo systemctl start node_exporter
    
  7. Verify installation:

    sudo systemctl status node_exporter
    

    Also check if the metrics endpoint is accessible:

    curl http://localhost:9100/metrics
    

Troubleshooting

  1. 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
  2. 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
  3. 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