Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Node Exporter

Node Exporter is a Prometheus exporter for hardware and OS metrics exposed by *NIX kernels. It collects system-level metrics such as CPU, memory, disk I/O, network statistics, and file system usage, making them available to Prometheus for monitoring and alerting.

Overview

Node Exporter is what is used to retrieve metrics from a host. These metrics are fed into prometheus to allow for meaningful visualizations and alerting.

Prerequisites

  • A Centos derived Linux operating system
  • Internet connectivity to download binaries
  • Prometheus install on this or another machine
  • sudo privileges
  • wget installed

Steps

  1. First we need to create a group and the node exporter user.

    sudo groupadd node_exporter
    sudo useradd -m -s /usr/sbin/nologin -d /var/lib/node_exporter --system -g node_exporter node_exporter
    
  2. Download the most recent (as of publication) package of node exporter and extract it. You can go to the node exporter download page and check for the latest one.

    wget https://github.com/prometheus/node_exporter/releases/download/v1.10.2/node_exporter-1.10.2.linux-amd64.tar.gz
    tar xvzf node*.tar.gz
    
  3. Install the binaries and set permissions.

    cd node*/
    sudo mv node_exporter /usr/local/bin
    sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
    sudo chown -R node_exporter:node_exporter /var/lib/node_exporter
    
  4. In order for node exporter to run at system start-up, you will need to create a systemd file. You can use the following as an example.

    sudo vi /etc/systemd/system/node_exporter.service
    

    NOTE: This is an example systemd file for node exporter

    [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 \
        --web.listen-address=0.0.0.0:9100 \
        --collector.textfile.directory=/var/lib/node_exporter
    
    [Install]
    WantedBy=multi-user.target
    
  5. Enable and start the node exporter service.

    sudo systemctl daemon-reload
    sudo systemctl enable node_exporter
    sudo systemctl start node_exporter
    sudo systemctl status node_exporter   
    
  6. If you have the firewall enabled, you will need to open a port to allow remote metric collection.

    sudo firewall-cmd --permanent --add-port=9100/tcp
    sudo firewall-cmd --reload
    
  7. If you are running SELinux you will need to execute the following to have systemd execute the file.

    sestatus
    
    sudo chcon -t bin_t /usr/local/bin/node_exporter
    sudo semanage fcontext -a -t bin_t "/usr/local/bin/node_exporter"
    sudo restorecon -v /usr/local/bin/node_exporter
    

Troubleshooting

Completion and Verification

  • You should be able to:
    curl http://localhost:9100/metrics
    curl http://localhost:9100/metrics | grep node_cpu
    
    node_exporter --version
    

Contacts

Appendix

References

Changelog

  • 2025/12/19 - Initial Version