Skip to content

Install Node Exporter on Linux

node_exporter is the program that is designed to monitor Linux host system by retrieving the system metrics of the operating system (cpu usage, memory, disk I/O usage, etc.).

Note

This documentation describes one example of the node_exporter installation. For other possibilities consult node_exporter GitHub page.

Requirements

To complete this guide you will need:

  • root access on Linux machine
  • connection to VM on which you want to install the node_exporter.
  • the security group should contain the following ports:
    • inbound rules: ssh (22), http (80), icmp (all), tcp (9100)
    • outboud rules: all

Set up node_exporter

Download node_exporter package

We recommended to install the latest node_exporter version. This example installs node_exporter v1.0.1, as it is the latest version available at the time of writing the documentation.

cd /tmp && \
curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz

Extract the archive

tar -xvzf node_exporter-1.0.1.linux-amd64.tar.gz
Following this, you can move the node_exporter directory within to our /usr/local/bin/.

chown root:root node_exporter-1.0.1.linux-amd64/node_exporter
chmod 755 node_exporter-1.0.1.linux-amd64/node_exporter
sudo mv node_exporter-1.0.1.linux-amd64/node_exporter /usr/local/bin/

Ensure the version is the one you downloaded (v1.0.1 in this example)

/usr/local/bin/node_exporter --version

Set up node_exporter as a service

  • Create a node_exporter user.

Add a user responsible for exporting VM's metrics. The user is a system user -r who is unable to get a shell -s /bin/false.

sudo useradd -rs /bin/false node_exporter
  • We can create a service file for the node_exporter under systemd.

sudo vi /etc/systemd/system/node_exporter.service
With the following contents:

[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

Start the node_exporter service

You can now start the service:

  • Reload the system daemon and start the node_exporter service.
sudo systemctl daemon-reload
sudo systemctl start node_exporter
  • Check the status of the node_exporter to be sure that it is executed with an active state.
sudo systemctl status node_exporter

Warning

node_exporter is exposing metrics on port 9100. Please make sure that the above requirements are fulfilled.

  • Activate node_exporter service when the server starts.
sudo systemctl enable node_exporter
  • Check exported metrics

Once node_exporter is installed and running, you can verify that metrics are being exported by executing curl command on the /metrics endpoint:

curl http://localhost:9100/metrics

node_exporter is now exposing metrics that Prometheus can scrape, including a wide variety of system metrics (prefixed with node_). To view those metrics:

curl http://localhost:9100/metrics | grep "node_"