Prometheus: Node Exporter – Install and Config – Ubuntu, CentOS

What is Node Exporter? Node Exporter is a Prometheus exporter for hardware and OS metrics with pluggable metric collectors.

It allows to measure various machine resources such as memory, disk and CPU utilization.

In this article I’ll show how to install and configure Node Exporter on Ubuntu and CentOS using a systemd service manager.

Cool Tip: Install Prometheus using Docker on Ubuntu and CentOS! Read More →

Node Exporter: Install and Config

Create unprivileged node_exporter user:

$ sudo useradd node_exporter -s /sbin/nologin

Check the download page for the latest compiled binary of the Node Exporter and download it:

$ wget*/node_exporter-*.*-amd64.tar.gz
$ tar xvfz node_exporter-*.*-amd64.tar.gz
$ sudo cp node_exporter-*.*-amd64/node_exporter /usr/sbin/

Create a systemd service file /etc/systemd/system/node_exporter.service:

Description=Node Exporter

ExecStart=/usr/sbin/node_exporter $OPTIONS


Create a sysconfig file:

$ sudo mkdir -p /etc/sysconfig
$ sudo touch /etc/sysconfig/node_exporter

Use this file to define options to provide, for example:

OPTIONS=" /var/lib/node_exporter/textfile_collector"

To check the all available options, run:

$ /usr/sbin/node_exporter --help

Reload systemd configuration and configure node_exporter to auto-start on system boot:

$ sudo systemctl daemon-reload
$ sudo systemctl enable node_exporter

Start the node_exporter service:

$ sudo systemctl start node_exporter

Once the Node Exporter is installed, verify that metrics are being exported:

$ curl http://localhost:9100/metrics

Add Node Exporter Target to Prometheus

Now all that’s left is to tell Prometheus server about the new target.

This needs to be done in the Prometheus config, as Node Exporter just exposes metrics and Prometheus pulls them from the targets it knows about.

Open your Prometheus config file prometheus.yml, and add your machine to the scrape_configs section as follows:

  - job_name: 'node'
      - targets: ['$NODE_IP:9100']

Reload the Prometheus config, and you should now be able to access your server’s metrics through Prometheus!

4 Replies to “Prometheus: Node Exporter – Install and Config – Ubuntu, CentOS”

  1. let’s say, I have apache in one machine but I want to install node exporter on another machine. Is it possible?

  2. Yes node exporter can run independently away on a different machine than which is running Apache
    If you want node exporter to expose metrics related to Apache, make sure those metrics are visible to node exporter via a shared drive

  3. How to configure node_exporter on centos 6 as there is no systemd ?

  4. hey, do i have to run node _expoter on the machine i want to expose metrics of ?

    i have a different admin machine , where i am running prometheus and grafana.
    for prometheus to be able to scrape metrics from node_expoter , does nodeexpo have to be run on my main instance ? or can i run it on admin and expose main instance metric to node via config files and then prome can scrape off of it.

Leave a Reply