Browse Source

hook prometheus to blackbox exporter

monitoring
histausse 1 year ago
parent
commit
0df6a16382
Signed by: histausse
GPG Key ID: 67486F107F62E9E9
  1. 2
      roles/prometheus-blackbox-exporter/tasks/main.yml
  2. 23
      roles/prometheus/templates/prometheus.yml

2
roles/prometheus-blackbox-exporter/tasks/main.yml

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

23
roles/prometheus/templates/prometheus.yml

@ -63,3 +63,26 @@ scrape_configs:
ca_file: '/etc/prometheus/ca.crt'
cert_file: '/etc/prometheus/prometheus-{{ lan_address }}.crt'
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 %}

Loading…
Cancel
Save