1
1
Fork 0
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2024-06-02 01:26:04 +02:00

prometheus: restrict vhost handling to http_prometheus

Makes prometheus.yml less noisy and doesn't break when non-vhost
mappings are added to blackbox_targets.
This commit is contained in:
Evangelos Foutras 2022-04-18 05:56:21 +03:00
parent a1cc586d23
commit 22aee43650
No known key found for this signature in database
GPG Key ID: 51E8B148A9999C34

View File

@ -155,6 +155,7 @@ scrape_configs:
{% for target in blackbox_targets[module] | select('string') %}
- {{ target }}
{% endfor %}
{% if module == 'http_prometheus' %}
{% for vhost in blackbox_targets[module] | select('mapping') %}
- targets:
{% for target in vhost.targets %}
@ -163,6 +164,7 @@ scrape_configs:
labels:
vhost: {{ vhost.hostname }}
{% endfor %}
{% endif %}
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
@ -170,8 +172,10 @@ scrape_configs:
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115
{% if module == 'http_prometheus' %}
- source_labels: [vhost]
target_label: __param_hostname
{% endif %}
{% endfor %}
{% for endpoint in matrix_metrics_endpoints %}