Skip to content
Snippets Groups Projects
Verified Commit 22aee436 authored by Evangelos Foutras's avatar Evangelos Foutras :smiley_cat:
Browse files

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.
parent a1cc586d
No related branches found
No related tags found
No related merge requests found
Pipeline #17493 passed
...@@ -155,6 +155,7 @@ scrape_configs: ...@@ -155,6 +155,7 @@ scrape_configs:
{% for target in blackbox_targets[module] | select('string') %} {% for target in blackbox_targets[module] | select('string') %}
- {{ target }} - {{ target }}
{% endfor %} {% endfor %}
{% if module == 'http_prometheus' %}
{% for vhost in blackbox_targets[module] | select('mapping') %} {% for vhost in blackbox_targets[module] | select('mapping') %}
- targets: - targets:
{% for target in vhost.targets %} {% for target in vhost.targets %}
...@@ -163,6 +164,7 @@ scrape_configs: ...@@ -163,6 +164,7 @@ scrape_configs:
labels: labels:
vhost: {{ vhost.hostname }} vhost: {{ vhost.hostname }}
{% endfor %} {% endfor %}
{% endif %}
relabel_configs: relabel_configs:
- source_labels: [__address__] - source_labels: [__address__]
target_label: __param_target target_label: __param_target
...@@ -170,8 +172,10 @@ scrape_configs: ...@@ -170,8 +172,10 @@ scrape_configs:
target_label: instance target_label: instance
- target_label: __address__ - target_label: __address__
replacement: 127.0.0.1:9115 replacement: 127.0.0.1:9115
{% if module == 'http_prometheus' %}
- source_labels: [vhost] - source_labels: [vhost]
target_label: __param_hostname target_label: __param_hostname
{% endif %}
{% endfor %} {% endfor %}
{% for endpoint in matrix_metrics_endpoints %} {% for endpoint in matrix_metrics_endpoints %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment