Browse Source

Fixing multiple jobs generation

2.6.2/master
Philippe Caseiro 1 year ago
parent
commit
a5b6333599
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      tmpl/prometheus.yml

+ 10
- 2
tmpl/prometheus.yml View File

@@ -44,12 +44,20 @@ scrape_configs:
44 44
     scrape_interval: %%{job.scrpInterval}s
45 45
     scrape_timeout: %%{job.scrpTimeout}s
46 46
     scheme: %%job.scrpScheme
47
-  %for %%target in %%getVar('prOpenTarg',[])
47
+  %set first = True
48 48
     static_configs:
49
+      - targets: [ %slurp
50
+  %for %%target in %%getVar('prOpenTarg',[])
49 51
     %if %%target.prOpenTargJob == %%job
50
-      - targets: [ "%%target.prOpenTargIP:%%target.prOpenTargPort" ]
52
+       %if %%first
53
+"%%target.prOpenTargIP:%%target.prOpenTargPort"%slurp
54
+          %set first = False
55
+       %else
56
+, "%%target.prOpenTargIP:%%target.prOpenTargPort"%slurp
57
+       %end if
51 58
     %end if
52 59
   %end for
60
+ ]
53 61
 %end for
54 62
 
55 63
 %if %%getVar('activerAlertmanager','non') == 'oui'

Loading…
Cancel
Save