dump more ideas on blackbox, cc @lelutin #41655 authored by anarcat's avatar anarcat
......@@ -1977,6 +1977,33 @@ requests, ICMP ping, etc) for a list of targets of its own. So the Prometheus
server has one target, the host with the port for the `blackbox_exporter`, but
that exporter in turn is set to check other hosts.
This is done with the [`relabel_config`](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) setting in the job
definition, like this:
relabel_configs:
- source_labels:
- '__address__'
target_label: '__param_target'
- source_labels:
- '__param_target'
target_label: 'instance'
- target_label: '__address__'
replacement: 'localhost:9115'
What this does is replace the `__address__` magic label with
`localhost:9115` so that Prometheus, instead of trying to scrape the
`instance` directly, will scrape the `blackbox_exporter` (here running
on `localhost:9115`), and *pass it the `instance` through the
`__param_target` parameter. (Actually, Prometheus converts
`__param_target` to `target=` on the scrape job.)
TODO: mention blackbox alias:
```
+ - source_labels: [__param_target]
+ target_label: alias
```
The [upstream documentation][] has some details that can help. We also
have examples [above][] for how to configure it in our setup.
......
......