Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Updating with Docker is straight-forward.  We just need to pull the (latest) image and then re-run our run-container.sh script.

Code Block
languagebash
docker pull prom/prometheus
./run-container.sh

Installing and configuring node_exporter (to monitor server stats)

node_exporter is a prometheus exporter which monitors hardware and 'nix OS metrics.  It runs on a port exposed to prometheus and prometheus can then query it and get a (large) ranger of metrics for whatever machine is running node_exporter.

By default node_exporter enables a large number of "collectors" (modules which collect certain information from the machine).  See here for a list of collectors enabled by default (and what info they collect).

node_exporter can be run from a docker container, but it's not recommended since it should be run directly on the host hardware to collect stats.

Installing node_exporter can be done by downloading a recent version version, untar'ing and executing.  We're going to be doing an extra step here to manage node_exporter with systemd (so it starts on server boot etc.).

We start with downloading.  You can find a link for the latest version at https://prometheus.io/download/#node_exporter.  At the time of this writing the latest stable version for linux-amd64 was node_exporter-0.18.1.linux-amd64.tar.gz.

We'll download, untar, and then move it to /opt/node_exporter

Code Block
languagebash
wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
tar -xf node_exporter-0.18.1.linux-amd64.tar.gz
sudo mv node_exporter-0.18.1.linux-amd64 /opt/node_exporter

With node_exporter installed let's make it easier to manage by creating a systemd service.  Create a file in /etc/systemd/system/ with your favourite text editor (I'm using vim here):

Code Block
languagebash
sudo vim /etc/systemd/system/node_exporter.service

and paste the following:

Code Block
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/opt/node_exporter --web.listen-address=:10091

[Install]
WantedBy=multi-user.target


Info

I'm using a non-default port here (10091) so change it to whatever port you prefer (or have free).

Finally let's enable it (to start on boot) and start the service

Code Block
sudo systemctl daemon-reload
sudo systemctl enable --now node_exporter

Installing and configuring blackbox (to monitor endpoints)

...

References

  1. https://prometheus.io/
  2. https://github.com/prometheus/node_exporter
  3. https://prometheus.io/download/#node_exporter
  4. https://grafana.com/

...