Explorar el Código

Added first scrape configs for different host groups

Till Klocke hace 7 años
padre
commit
69efcff74b
Se han modificado 1 ficheros con 16 adiciones y 5 borrados
  1. 16 5
      roles/service-prometheus/templates/prometheus_config.j2

+ 16 - 5
roles/service-prometheus/templates/prometheus_config.j2

@@ -9,11 +9,22 @@ global:
 # A scrape configuration containing exactly one endpoint to scrape:
 # Here it's Prometheus itself.
 scrape_configs:
-  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
-  - job_name: 'prometheus'
-
-    # Override the global default and scrape targets from this job every 5 seconds.
+  - job_name: 'supernodes'
+    scheme: https
+    bearer_token: '{{ hostvars[groups['supernodes'][0]]['node_exporter_authorization_token'] }}'
     scrape_interval: 5s
+    static_configs:
+      - targets: 
+{% for host in groups['supernodes'] %}
+        - '{{ host }}'
+{% endfor %}
 
+  - job_name: 'mapservers'
+    scheme: https
+    bearer_token: '{{ hostvars[groups['mapservers'][0]]['node_exporter_authorization_token'] }}'
+    scrape_interval: 5s
     static_configs:
-      - targets: ['localhost:9090']
+      - targets: 
+{% for host in groups['mapservers'] %}
+        - '{{ host }}'
+{% endfor %}