Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Export Stats For Prometheus With Node Exporter

After having deployed your own Prometheus server, you probably want to start monitoring some servers. To do this you need to set get your servers to export their stats.


Install the node exporter with:

cd $HOME
tar --extract --gzip --file node_exporter-0.18.1.linux-amd64.tar.gz
rm node_exporter-0.18.1.linux-amd64.tar.gz

Then run the exporter with:

cd $HOME/node_exporter-0.18.1.linux-amd64

You can see your server's current stats by going to port 9100 of your server's IP/hostname in your browser.

Configure Prometheus

We now need to configure prometheus to fetch those stats in order to monitor the server. This is done by editing our prometheus.yml configuration file on our Prometheus server.

Then update the prometheus.yml file to configure the server to "scrape" from there. This is by adding the hostname/port to the targets as shown in the section below with my.server.hostname.:9100 as the example.

  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    - targets: ['localhost:9090', 'my.server.hostname.:9100']
Last updated: 22nd January 2020
First published: 22nd January 2020