selfrest.blogg.se

Prometheus blackbox exporter example
Prometheus blackbox exporter example




prometheus blackbox exporter example

prometheus blackbox exporter example

Tell blackbox_exporter to reload its config: killall -HUP blackbox_exporter The configuration file can be extended with other types of tests.Įdit /etc/prometheus/blackbox.yml so it looks like this: modules: This is how you can get a poor man’s test for the proportion of packets lost (although you may be better off with smokeping or perfsonar for this application).Īlternatively you could use another exporter such as ping_exporter or smokeping_prober 6 DNS and HTTP checks If you want to get the proportion of packets lost over time, you will need to use a prometheus range query for this: avg_over_time(probe_success) Notice how for the dummy target 1.2.3.4, we have metric up 1 (meaning that the scrape job was able to communicate successfully with blackbox_exporter) but probe_success 0 (which is the result from blackbox_exporter). Return to the prometheus web interface at Journalctl -eu prometheus # CHECK FOR ERRORS! 5 Testing Now get prometheus to pick up the changes: killall -HUP prometheus For an explanation of this section, see the end of the “snmp_exporter” exercise. The dash before job_name should align exactly with the dashes of earlier job_name entries. Replacement: 127.0.0.1:9115 # blackbox exporterīe careful with spacing. (1.2.3.4 is an address which we know is not going to respond)Įdit /etc/prometheus/prometheus.yml and add the following to the bottom of the scrape_configs: section: - job_name: 'blackbox' We now need to configure prometheus to scrape the blackbox_exporter.įirstly, configure a targets file /etc/prometheus/targets.d/blackbox.yml containing the following: - labels: This will usually make it clear at what step the probe encountered a problem. NOTE: if you have a problem, you can get detailed logs from the probe in the HTTP response by adding &debug=true to the URL: curl 'localhost:9115/probe?target=&module=ping4&debug=true' Therefore, if that one packet gets lost, you will get a success of 0. Unlike nagios: this only sends a single ping.

#Prometheus blackbox exporter example plus

The response should include probe_success 1 if the remote host responded, plus metrics for the time taken for the DNS query and the time taken for the overall probe. curl 'localhost:9115/probe?target=&module=ping4' You will need to quote the URL because it contains the special & character. You need to provide two arguments: the module, and the target (hostname or address to test). If there are any errors, then go back and fix them. Use cursor keys to move around the journalctl log output, and “q” to quit. Journalctl -eu blackbox_exporter # check for "Listening on address" address=127.0.0.1:9115 Systemctl start blackbox_exporter # start now Now start blackbox_exporter: systemctl enable blackbox_exporter # start on future boots There is a sample configuration in /opt/blackbox_exporter/blackbox.yml but we will create one from scratch.Ĭreate /etc/prometheus/blackbox.yml with the following contents: modules: Tell systemd to read this new file: systemctl daemon-reloadĪlso create an options file /etc/default/blackbox_exporter with the following contents: OPTIONS='-web.listen-address=127.0.0.1:9115 -config.file=/etc/prometheus/blackbox.yml' 2 Start blackbox_exporter Use a text editor to create a systemd unit file /etc/systemd/system/blackbox_rvice with the following contents: ĮnvironmentFile=/etc/default/blackbox_exporterĮxecStart=/opt/blackbox_exporter/blackbox_exporter $OPTIONS Ln -s blackbox_exporter-X.Y.Z.linux-amd64 /opt/blackbox_exporter Tar -C /opt -xvzf blackbox_exporter-X.Y.Z. (If blackbox_exporter is pre-installed, skip to the next section “Start blackbox_exporter”)įetch and unpack the latest release from the releases page and create a symlink so that /opt/blackbox_exporter refers to the current version. You then scrape blackbox_exporter from prometheus, and each scrape triggers a check. You run the blackbox_exporter at the place where the checks should originate - this can be on your prometheus server (although it doesn’t have to be). The setup is somewhat like snmp_exporter.

prometheus blackbox exporter example prometheus blackbox exporter example

Prometheus can perform Nagios-like “blackbox” service testing - such as pings, http queries and DNS checks - using the blackbox_exporter.






Prometheus blackbox exporter example