Improving dico to be more Prometheus like

We need to be closer to the prometheus way to do things
This commit is contained in:
Philippe Caseiro 2018-06-06 16:09:57 +02:00
parent ab479fd33a
commit e95d6f9e1d
2 changed files with 28 additions and 25 deletions

View File

@ -47,9 +47,19 @@
<variable name='job_file_config' type='string' description="Emplacement des fichiers de configuration des noeuds" auto_freeze='True' mode='expert' mandatory='True'>
<value>/etc/prometheus/nodes</value>
</variable>
<variable name='addTargetPrometheus' type='oui/non' description="Ajouter des cibles statiques à Prometheus">
<value>non</value>
</variable>
<!-- Job standard -->
<variable name='prTarg' type='string' description='Nom de la cible prometheus' multi='True'/>
<variable name='prTargIP' type='ip' description="Adresse IP de la cible prometheus"/>
<variable name='prTargSonde' type='string' description="Sonde a utiliser pour ce client">
<value>Node Exporter</value>
</variable>
</family>
<family name='Jobs prometheus'>
<variable name='promJobs' type='string' description="Nom du job prometheus"/>
<variable name='promJobs' type='string' description="Nom du job prometheus" multi='True'/>
<variable name='honorLabels' type='oui/non' description='Garder les labels en cas de conflit' mode='expert'>
<value>oui</value>
</variable>
@ -63,19 +73,7 @@
<value>http</value>
</variable>
<variable name='addTargetPrometheus' type='oui/non' description="Ajouter des cibles statiques à Prometheus">
<value>non</value>
</variable>
<!-- Job standard -->
<variable name='prTarg' type='string' description='Nom de la cible prometheus' multi='True'/>
<variable name='prTargJob' type='string' description='Nom du job de rattachement de la cible'/>
<variable name='prTargIP' type='ip' description="Adresse IP de la cible prometheus"/>
<variable name='prTargSonde' type='string' description="Sonde a utiliser pour ce client">
<value>Node Exporter</value>
</variable>
<variable name='addPrOpenTarg' type='oui/non' description="Ajouter un client personnalisé">
<variable name='addPrOpenTarg' type='oui/non' description="Ajouter des cibles statiques pour les jobs personnalisé">
<value>non</value>
</variable>
<!-- Job libre -->
@ -141,6 +139,7 @@
<separators>
<separator name='activer_grafana'>Services complèmentairse</separator>
<separator name='prometheusJobName'>Configuration du serveur Prometheus</separator>
<separator name='job_name_node'>Configuration des jobs standards</separator>
<separator name='alSMTPHost'>Configuration SMTP pour l'envois des alertes</separator>
<separator name='alReceiver'>Destinatires</separator>
<separator name='alRoute'>Rêgles de distribution simples</separator>
@ -155,6 +154,13 @@
<slave>alReceiverEmail</slave>
</group>
<group master='promJobs'>
<slave>scrpInterval</slave>
<slave>scrpTimeout</slave>
<slave>honorLabels</slave>
<slave>scrpScheme</slave>
</group>
<group master='alRoute'>
<slave>alRouteMatchSource</slave>
<slave>alRouteMatchValue</slave>
@ -175,7 +181,6 @@
<group master='prTarg'>
<slave>prTargIP</slave>
<slave>prTargJob</slave>
<slave>prTargSonde</slave>
</group>
@ -186,7 +191,7 @@
</group>
<check name='valid_enum' target='prTargSonde'>
<param>['Node Exporter','Port']</param>
<param>['Node Exporter']</param>
</check>
<check name='valid_enum' target='scrpScheme'>

View File

@ -26,25 +26,23 @@ scrape_configs:
%if %%getVar('addTargetPrometheus','non') == 'oui'
static_configs:
- targets: [ "%%adresse_ip_eth0:9100"%slurp
%if %%getVar('ajout_client_prometheus','non') == 'oui'
%for %%cliPr in %%getVar('prCli',[])
%if %%cliPr.prCliSonde == 'Node Exporter'
, '%%cliPr.prCliIP:9100'%slurp
%for %%cliPr in %%getVar('prTarg',[])
%if %%cliPr.prTargSonde == 'Node Exporter'
, '%%cliPr.prTargIP:9100'%slurp
%end if
%end for
%end if
]
%end if
%for %%job in %%getVar['promJobs',[]]
%for %%job in %%getVar('promJobs', [])
- job_name: '%%job'
%if %%job.honorLabels == 'oui'
honor_labels: true
%else
honor_labels; false
honor_labels: false
%end if
scrape_interval: %%job.scrpInterval
scrape_timeout: %%job.scrpTimeout
scrape_interval: %%{job.scrpInterval}s
scrape_timeout: %%{job.scrpTimeout}s
scheme: %%job.scrpScheme
%for %%target in %%getVar('prOpenTarg',[])
static_configs: