Deployment

In our static infrastructure test environment, we can validate the configuration of blackbox_exporter by connecting to the target01 instance as shown here:

cd ./chapter06/

vagrant ssh target01

Then checking the configuration of the provided systemd unit file as shown in the following command:

vagrant@target01:~$ systemctl cat blackbox-exporter
The configuration can be reloaded in runtime by sending an HTTP POST to the /-/reload endpoint or a SIGHUP to the blackbox_exporter process. If there are configuration errors, it will not be applied.

We can see all the required arguments for the blackbox_exporter service in the following snippet from the unit file, including the path to the configuration file:

...
ExecStart=/usr/bin/blackbox_exporter --config.file=/etc/blackbox_exporter/blackbox.yml
...

The configuration we tailored for our example can be found in the following snippet:

modules:
http_2xx:
prober: http
http:
preferred_ip_protocol: ip4

icmp:
prober: icmp
icmp:
preferred_ip_protocol: ip4
Notice preferred_ip_protocol: ip4 is used, as blackbox_exporter prefers ipv6, but we're forcing ipv4 in our probes.

On the Prometheus instance, we added the following jobs:

- job_name: 'blackbox-http'
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets: [ 'http://example.com', 'https://example.com:443' ]
...
- job_name: 'blackbox-icmp'
metrics_path: /probe
params:
module: [icmp]
static_configs:
- targets:
- prometheus
...

Using the Prometheus web interface, available at http://192.168.42.10:9090/targets, we can validate whether the scrapes are successful (independently of the return status of the probes):

Figure 6.12: Prometheus /targets endpoint showing the blackbox_exporter targets

As mentioned before, the /targets page doesn't tell you whether a probe was successful or not. This needs to be validated in the expression browser by querying the probe_success metric:

Figure 6.13: Prometheus expression browser showing the probe_success query results

Some interesting metrics that can be collected from blackbox_exporter (both about the exporter itself and from probes) are:

  • blackbox_exporter_config_last_reload_successful, which exposes if the exporter's configuration file was reloaded successfully after a SIGHUP
  • probe_http_status_code, which allows you to understand what HTTP status code is being returned when using the HTTP prober module
  • probe_ssl_earliest_cert_expiry, which returns the timestamp for when the certificate chain from a SSL probe becomes invalid due to one of the certificates in the chain expiring
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.26.176