Browse Source

Try 008

FixSondes
Philippe Caseiro 1 year ago
parent
commit
4a24601bea
1 changed files with 20 additions and 12 deletions
  1. 20
    12
      tmpl/prometheus.yml

+ 20
- 12
tmpl/prometheus.yml View File

@@ -8,30 +8,38 @@ rule_files:
8 8
 - "/etc/prometheus/rules.d/*.yml"
9 9
 
10 10
 scrape_configs:
11
-  - job_name: %%prometheusJobName 
11
+  - job_name: %%prometheusJobName
12 12
     honor_labels: true
13 13
 
14 14
     static_configs:
15
-      - targets: ['%%nom_domaine_machine:9090']
15
+      - targets: ['%%nom_domaine_machine:9090'%slurp
16 16
 %if %%getVar('activerSndNodeExpoter','non') == 'oui'
17
-      - targets: ['%%nom_domaine_machine:9100']
17
+, '%%nom_domaine_machine:9100'%slurp
18 18
 %end if
19
+]
19 20
 
20 21
   - job_name: '%%job_name_node'
21 22
     file_sd_configs:
22 23
       - files: [ "%%job_file_config/*.yml" ]
24
+%if %%is_empty('ajout_client_prometheus') or %%is_empty('addPrOpenCli')
25
+# Nothing to configure
26
+%else
23 27
     static_configs:
24
-%if %%getVar('ajout_client_prometheus','non') == 'oui'
25
-  %for %%cliPr in %%getVar('prCli',[])
26
-    %if %%cliPr.prCliSonde == 'Node Exporter'
27
-      - targets: ['%%cliPr.prCliIP:9100']
28
+        - targets: [ "127.0.0.1:9100"%slurp
29
+    %if %%getVar('ajout_client_prometheus','non') == 'oui'
30
+        %for %%cliPr in %%getVar('prCli',[])
31
+            %if %%cliPr.prCliSonde == 'Node Exporter'
32
+, '%%cliPr.prCliIP:9100'%slurp
33
+            %end if
34
+        %end for
28 35
     %end if
29
-  %end for
30
-  %for %%cliOpen in %%getVar('prOpenCli',[])
31
-      - targets: ['%%cliOpen.prOpenCliIP:%%cliOpen.prOpenCliPort']
32
-  %end for
36
+    %if %%getVar('addPrOpenCli','non') == 'oui'
37
+        %for %%cliOpen in %%getVar('prOpenCli',[])
38
+, '%%cliOpen.prOpenCliIP:%%cliOpen.prOpenCliPort'%slurp
39
+        %end for
40
+    %end if
41
+]
33 42
 %end if
34
-
35 43
 #alerting:
36 44
 #  alertmanagers:
37 45
 #  - scheme: https

Loading…
Cancel
Save