Versions Compared

Key

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

...

Code Block
languagebash
chmod +x prometheusrun-container.sh
./prometheusrun-container.sh

Docker will then download the latest official Prometheus Docker image, create and configure the container and then run said container. 

...

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

We've already setup node_exporter in our prometheus configuration file (see lines 31 to 34). 

View Git file
pathprometheus.yml
lastline34
repository-id8
firstline31
branchrefs/tags/documented
linenumberstrue
 

Installing and configuring blackbox (to monitor endpoints)

Blackbox exporter is a prometheus exporter which can probe endpoints via http/https, icmp, etc.  It's extremely simple to setup and can be used to monitor the status of various endpoints (which could be web applications, REST endpoints, etc.).

We'll be using the a docker image to install and configure Blackbox exporter.

Start by cloning https://gitlab.jaytaala.com/docker/blackbox:

Code Block
languagebash
git clone https://gitlab.jaytaala.com/docker/blackbox

Similar to our prometheus docker image install, the repo contains only two files (which are the only two we need):

  • run-container.sh : shell script that will run our docker command to install / configure blackbox exporter;
  • config.yml : single configuration file for for blackbox exporter.

To setup and run our blackbox exporter simply make the run-container.sh executable and run it:

Code Block
languagebash
chmod +x run-container.sh
./run-container.sh

This will start blackbox-exporter on the default port (9115).  The config.yml file is similar to the default blackbox-exporter config.yml, but set the preferred ip protocol to ipv4 (by default it uses ipv6).

We've already setup blackbox-exporter in our prometheus configuration file (see lines 36 to 57). 

View Git file
pathprometheus.yml
lastline57
repository-id8
firstline36
branchrefs/tags/documented
linenumberstrue
 

Info

Note: the internal ip address on line 57 must be the actual ip address of our host (not 127.0.0.1 as from the docker image, 127.0.0.1 is the docker image and not the host machine/server).

Add any other endpoints in the targets section of the yml.

Installing and configuring Grafana

Grafana is a great 

Finally, we install and setup grafana

References

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

...