Fixing multiple jobs generation

This commit is contained in:
Philippe Caseiro 2018-06-11 15:42:36 +02:00
parent 37342e8700
commit a5b6333599

View File

@ -44,12 +44,20 @@ scrape_configs:
scrape_interval: %%{job.scrpInterval}s
scrape_timeout: %%{job.scrpTimeout}s
scheme: %%job.scrpScheme
%for %%target in %%getVar('prOpenTarg',[])
%set first = True
static_configs:
- targets: [ %slurp
%for %%target in %%getVar('prOpenTarg',[])
%if %%target.prOpenTargJob == %%job
- targets: [ "%%target.prOpenTargIP:%%target.prOpenTargPort" ]
%if %%first
"%%target.prOpenTargIP:%%target.prOpenTargPort"%slurp
%set first = False
%else
, "%%target.prOpenTargIP:%%target.prOpenTargPort"%slurp
%end if
%end if
%end for
]
%end for
%if %%getVar('activerAlertmanager','non') == 'oui'