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'> <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> <value>/etc/prometheus/nodes</value>
</variable> </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>
<family name='Jobs prometheus'> <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'> <variable name='honorLabels' type='oui/non' description='Garder les labels en cas de conflit' mode='expert'>
<value>oui</value> <value>oui</value>
</variable> </variable>
@ -63,19 +73,7 @@
<value>http</value> <value>http</value>
</variable> </variable>
<variable name='addTargetPrometheus' type='oui/non' description="Ajouter des cibles statiques à Prometheus"> <variable name='addPrOpenTarg' type='oui/non' description="Ajouter des cibles statiques pour les jobs personnalisé">
<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é">
<value>non</value> <value>non</value>
</variable> </variable>
<!-- Job libre --> <!-- Job libre -->
@ -141,6 +139,7 @@
<separators> <separators>
<separator name='activer_grafana'>Services complèmentairse</separator> <separator name='activer_grafana'>Services complèmentairse</separator>
<separator name='prometheusJobName'>Configuration du serveur Prometheus</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='alSMTPHost'>Configuration SMTP pour l'envois des alertes</separator>
<separator name='alReceiver'>Destinatires</separator> <separator name='alReceiver'>Destinatires</separator>
<separator name='alRoute'>Rêgles de distribution simples</separator> <separator name='alRoute'>Rêgles de distribution simples</separator>
@ -155,6 +154,13 @@
<slave>alReceiverEmail</slave> <slave>alReceiverEmail</slave>
</group> </group>
<group master='promJobs'>
<slave>scrpInterval</slave>
<slave>scrpTimeout</slave>
<slave>honorLabels</slave>
<slave>scrpScheme</slave>
</group>
<group master='alRoute'> <group master='alRoute'>
<slave>alRouteMatchSource</slave> <slave>alRouteMatchSource</slave>
<slave>alRouteMatchValue</slave> <slave>alRouteMatchValue</slave>
@ -175,7 +181,6 @@
<group master='prTarg'> <group master='prTarg'>
<slave>prTargIP</slave> <slave>prTargIP</slave>
<slave>prTargJob</slave>
<slave>prTargSonde</slave> <slave>prTargSonde</slave>
</group> </group>
@ -186,7 +191,7 @@
</group> </group>
<check name='valid_enum' target='prTargSonde'> <check name='valid_enum' target='prTargSonde'>
<param>['Node Exporter','Port']</param> <param>['Node Exporter']</param>
</check> </check>
<check name='valid_enum' target='scrpScheme'> <check name='valid_enum' target='scrpScheme'>

View File

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