Blackbox exporter configuration: Difference between revisions
From wikinotes
(Created page with "* You define your own test-modules (endpoints test-conditions) in <code>blackbox_exporter.yml</code>. * You configure test-modules to test endpoints with in your <code>prometh...") |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
* You define your own test-modules (endpoints test-conditions) in <code>blackbox_exporter.yml</code>. | * You define your own test-modules (endpoints test-conditions) in <code>blackbox_exporter.yml</code>. | ||
* You configure test-modules to test endpoints with in your <code>prometheus.yml</code>. | * You configure test-modules to test endpoints with in your <code>prometheus.yml</code>. | ||
= Documentation = | |||
<blockquote> | |||
{| class="wikitable" | |||
|- | |||
| github || https://github.com/prometheus/blackbox_exporter | |||
|- | |||
| config syntax || https://github.com/prometheus/blackbox_exporter/blob/master/CONFIGURATION.md | |||
|- | |||
| example config || https://github.com/prometheus/blackbox_exporter/blob/master/example.yml | |||
|} | |||
</blockquote><!-- Documentation --> | |||
= Define Test-Modules = | = Define Test-Modules = | ||
Line 62: | Line 74: | ||
This config creates a scrape-job that uses our <code>http_2xx</code> module to test both <code>https://foo.com</code> and <code>https://bar.net</code>. | This config creates a scrape-job that uses our <code>http_2xx</code> module to test both <code>https://foo.com</code> and <code>https://bar.net</code>. | ||
</blockquote><!-- use modules --> |
Latest revision as of 16:31, 2 July 2022
- You define your own test-modules (endpoints test-conditions) in
blackbox_exporter.yml
. - You configure test-modules to test endpoints with in your
prometheus.yml
.
Documentation
Define Test-Modules
# /usr/local/etc/blackbox_exporter.yml modules: https_2xx: prober: http timeout: 5s http: valid_status_codes: [2] # any 2xx status fail_if_not_ssl: true no_follow_redirects: true preferred_ip_protocol: ip4 http_401: prober: http timeout: 5s http: valid_status_codes: [401] method: GET fail_if_not_ssl: true no_follow_redirects: true preferred_ip_protocol: ip4Here we configure two test-modules.
The first tests for a HTTP-2XX return-code, the second for an HTTP-401.See the sample config where all options/types are documented.
Use Modules
# /usr/local/etc/prometheus.yml global: scrape_interval: 120s scrape_configs: - job_name: https_2xx metrics_path: /probe params: module: [https_2xx] static_configs: - targets: - https://foo.com - https://bar.net relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9115This config creates a scrape-job that uses our
http_2xx
module to test bothhttps://foo.com
andhttps://bar.net
.