summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-08-31 16:40:26 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-08-31 16:40:26 +0200
commit5c41b54696c1c04978da1372d84a398aad58b287 (patch)
tree7fd42af9809312989ed7fc28788b0abbb3e4c745 /roles
parentprometheus/server: add support for remote-write (diff)
prometheus remote-write: refactor config to force naming destinations
Diffstat (limited to 'roles')
-rw-r--r--roles/monitoring/prometheus/server/defaults/main/main.yml5
-rw-r--r--roles/monitoring/prometheus/server/templates/prometheus.yml.j26
2 files changed, 7 insertions, 4 deletions
diff --git a/roles/monitoring/prometheus/server/defaults/main/main.yml b/roles/monitoring/prometheus/server/defaults/main/main.yml
index 61bc4323..dd290e9e 100644
--- a/roles/monitoring/prometheus/server/defaults/main/main.yml
+++ b/roles/monitoring/prometheus/server/defaults/main/main.yml
@@ -77,8 +77,9 @@ prometheus_server_web_listen_address: 127.0.0.1:9090
prometheus_server_remote_write_receiver: no
-# prometheus_server_remote_write_config:
-# - url: "https://mon.example.com/prometheus/api/v1/write"
+# prometheus_server_remote_write_destinations:
+# example:
+# url: "https://mon.example.com/prometheus/api/v1/write"
# basic_auth:
# username: remote
# password_file: /etc/prometheus/prometheus-remote.secret
diff --git a/roles/monitoring/prometheus/server/templates/prometheus.yml.j2 b/roles/monitoring/prometheus/server/templates/prometheus.yml.j2
index cf21dc80..d72a4815 100644
--- a/roles/monitoring/prometheus/server/templates/prometheus.yml.j2
+++ b/roles/monitoring/prometheus/server/templates/prometheus.yml.j2
@@ -96,8 +96,10 @@ scrape_configs:
- targets: ['{{ config.url }}']
{% endfor %}
{% endfor %}
-{% if prometheus_server_remote_write_config is defined %}
+{% if prometheus_server_remote_write_destinations is defined %}
remote_write:
- {{ prometheus_server_remote_write_config | to_nice_yaml(indent=2) | indent(2) }}
+{% for name, config in prometheus_server_remote_write_destinations.items() %}
+ - {{ config | combine({'name': name }) | to_nice_yaml(indent=2) | indent(4) }}
+{% endfor %}
{% endif %}