hook prometheus to blackbox exporter

This commit is contained in:
histausse 2021-10-07 23:50:51 +02:00
parent efdf4a21f9
commit 0df6a16382
Signed by: histausse
GPG key ID: 67486F107F62E9E9
2 changed files with 24 additions and 1 deletions

View file

@ -50,7 +50,7 @@
notify: Restart blackbox-exporter notify: Restart blackbox-exporter
loop: loop:
- https-internal - https-internal
- https-external-up - http-external-up
- http-external-down - http-external-down
#- name: Copy the web-config folder #- name: Copy the web-config folder

View file

@ -63,3 +63,26 @@ scrape_configs:
ca_file: '/etc/prometheus/ca.crt' ca_file: '/etc/prometheus/ca.crt'
cert_file: '/etc/prometheus/prometheus-{{ lan_address }}.crt' cert_file: '/etc/prometheus/prometheus-{{ lan_address }}.crt'
key_file: '/etc/prometheus/prometheus-{{ lan_address }}.key' key_file: '/etc/prometheus/prometheus-{{ lan_address }}.key'
{% for target_type in ('https-internal', 'http-external-up', 'http-external-down') %}
- job_name: blackbox {{ target_type }}
metrics_path: /probe
params:
module: [http_2xx]
file_sd_configs:
- files:
- '/etc/prometheus/blackbox-{{ target_type }}-targets.json'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: {{ lan_address }}:9115
scheme: https
tls_config:
ca_file: '/etc/prometheus/ca.crt'
cert_file: '/etc/prometheus/prometheus-{{ lan_address }}.crt'
key_file: '/etc/prometheus/prometheus-{{ lan_address }}.key'
{% endfor %}