summaryrefslogtreecommitdiffstats
path: root/roles/prometheus/templates/prometheus.yml.j2
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-09-18 16:42:41 +0200
committerAhmed Abdelhalim <[email protected]>2025-09-18 16:42:41 +0200
commit9ce66cb8a69a874d9219e4df48dfa28e92b587b0 (patch)
tree5def586496570d33a45c1491ec26f13fc812ed41 /roles/prometheus/templates/prometheus.yml.j2
parent7e51b1642f6c848e7fc50dab609bf28c03e54e04 (diff)
Allow configuring multiple targets for prometheus
The default are localhost, but it can be overridden to allow scrapping localhost and or remote hosts (for both prometheus job and node exporter jobs)
Diffstat (limited to 'roles/prometheus/templates/prometheus.yml.j2')
-rw-r--r--roles/prometheus/templates/prometheus.yml.j25
1 files changed, 3 insertions, 2 deletions
diff --git a/roles/prometheus/templates/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2
index e39a69c0..c43864ea 100644
--- a/roles/prometheus/templates/prometheus.yml.j2
+++ b/roles/prometheus/templates/prometheus.yml.j2
@@ -1,3 +1,4 @@
+---
global:
scrape_interval: {{ prometheus_scrape_interval }}
evaluation_interval: {{ prometheus_scrape_interval }}
@@ -7,10 +8,10 @@ rule_files:
scrape_configs:
- job_name: 'prometheus'
static_configs:
- - targets: ['localhost:{{ prometheus_port }}']
+ - targets: {{ prometheus_targets | to_yaml }}
- job_name: 'node'
static_configs:
- - targets: ['localhost:{{ prometheus_node_exporter_port }}']
+ - targets: {{ prometheus_node_exporter_targets | to_yaml }}
scrape_interval: {{ prometheus_scrape_interval }}
metrics_path: /metrics