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 wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz 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 ./node_exporter
You can see your server's current stats by going to port 9100 of your server's IP/hostname in your browser.
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.
scrape_configs: # 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'. static_configs: - targets: ['localhost:9090', 'my.server.hostname.:9100']
First published: 22nd January 2020