Improve configuration flexibility to match prometheus way of doing

things
This commit is contained in:
2018-06-06 16:00:36 +02:00
parent e3a6295709
commit ab479fd33a
2 changed files with 133 additions and 96 deletions

View File

@ -18,12 +18,12 @@ scrape_configs:
%end if
]
- job_name: '%%job_name_node'
file_sd_configs:
- files: [ "%%job_file_config/*.yml" ]
%if %%is_empty('ajout_client_prometheus') or %%is_empty('addPrOpenCli')
# Nothing to configure
%else
%if %%getVar('addTargetPrometheus','non') == 'oui'
static_configs:
- targets: [ "%%adresse_ip_eth0:9100"%slurp
%if %%getVar('ajout_client_prometheus','non') == 'oui'
@ -33,14 +33,27 @@ scrape_configs:
%end if
%end for
%end if
%if %%getVar('addPrOpenCli','non') == 'oui'
%for %%cliOpen in %%getVar('prOpenCli',[])
, '%%cliOpen.prOpenCliIP:%%cliOpen.prOpenCliPort'%slurp
%end for
%end if
]
%end if
%for %%job in %%getVar['promJobs',[]]
- job_name: '%%job'
%if %%job.honorLabels == 'oui'
honor_labels: true
%else
honor_labels; false
%end if
scrape_interval: %%job.scrpInterval
scrape_timeout: %%job.scrpTimeout
scheme: %%job.scrpScheme
%for %%target in %%getVar('prOpenTarg',[])
static_configs:
%if %%target.prOpenTargJob == %%job
- targets: [ "%%target.prOpenTargIP:%%target.prOpenTargPort" ]
%end if
%end for
%end for
%if %%getVar('activerAlertmanager','non') == 'oui'
alerting:
alertmanagers: