Merge branch 'master' into dist/eole/2.6.2/master

This commit is contained in:
Philippe Caseiro 2018-06-06 16:47:31 +02:00
commit be23766fc2
3 changed files with 143 additions and 103 deletions

View File

@ -47,26 +47,42 @@
<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>
</family> <variable name='addTargetPrometheus' type='oui/non' description="Ajouter des cibles statiques à Prometheus">
<family name='Clients prometheus'>
<variable name='ajout_client_prometheus' type='oui/non' description="Ajouter un nouveau client à Prometheus">
<value>non</value> <value>non</value>
</variable> </variable>
<!-- Client standard -->
<variable name='prCli' type='string' description='Nom du client prometheus' multi='True'/>
<variable name='prCliIP' type='ip' description="Adresse IP du client prometheus"/>
<variable name='prCliSonde' type='string' description="Sonde a utiliser pour ce client">
<value>Node Exporter</value>
</variable>
<variable name='addPrOpenCli' type='oui/non' description="Ajouter un client personnalisé"> <!-- 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" multi='True'/>
<variable name='honorLabels' type='oui/non' description='Garder les labels en cas de conflit' mode='expert'>
<value>oui</value>
</variable>
<variable name='scrpInterval' type='number' description="Interval d'intérogation de la sonde (en secondes)">
<value>15</value>
</variable>
<variable name='scrpTimeout' type='number' description="Délais d'attente maximum lors de l'interrogation d'une sonde">
<value>10</value>
</variable>
<variable name='scrpScheme' type='string' description="Protocole à utiliser pour l'interrogation de la sonde">
<value>http</value>
</variable>
<variable name='addPrOpenTarg' type='oui/non' description="Ajouter des cibles statiques pour les jobs personnalisé">
<value>non</value> <value>non</value>
</variable> </variable>
<!-- Client libre --> <!-- Job libre -->
<variable name='prOpenCli' type='string' description='Nom du client personnalisé prometheus' multi='True'/> <variable name='prOpenTarg' type='string' description='Nom de la cible personnalisé prometheus' multi='True'/>
<variable name='prOpenCliIP' type='ip' description="Adresse IP"/> <variable name='prOpenTargJob' type='string' description='Nom du job de rattachement de la cible'/>
<variable name='prOpenCliPort' type='number' description="Port d'écoute de la sonde"/> <variable name='prOpenTargIP' type='ip' description="Adresse IP de la cible"/>
<variable name='prOpenTargPort' type='number' description="Port d'écoute de la sonde"/>
</family> </family>
<family name="grafana"> <family name="grafana">
<variable name='grafana_domain' type='string' description="Nom de Domaine ou IP pour accèder à l'interface Grafana" mandatory='True'> <variable name='grafana_domain' type='string' description="Nom de Domaine ou IP pour accèder à l'interface Grafana" mandatory='True'>
<value>localhost</value> <value>localhost</value>
@ -123,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>
@ -137,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>
@ -155,18 +179,23 @@
<slave>alSubRouteMatchReceiver</slave> <slave>alSubRouteMatchReceiver</slave>
</group> </group>
<group master='prCli'> <group master='prTarg'>
<slave>prCliIP</slave> <slave>prTargIP</slave>
<slave>prCliSonde</slave> <slave>prTargSonde</slave>
</group> </group>
<group master='prOpenCli'> <group master='prOpenTarg'>
<slave>prOpenCliIP</slave> <slave>prOpenTargIP</slave>
<slave>prOpenCliPort</slave> <slave>prOpenTargPort</slave>
<slave>prOpenTargJob</slave>
</group> </group>
<check name='valid_enum' target='prCliSonde'> <check name='valid_enum' target='prTargSonde'>
<param>['Node Exporter','Port']</param> <param>['Node Exporter']</param>
</check>
<check name='valid_enum' target='scrpScheme'>
<param>['http','https']</param>
</check> </check>
<check name='valid_enum' target='alRouteMatchSource'> <check name='valid_enum' target='alRouteMatchSource'>
@ -208,17 +237,17 @@
<target type='service_accesslist'>alertmanager</target> <target type='service_accesslist'>alertmanager</target>
</condition> </condition>
<condition name='disabled_if_in' source='ajout_client_prometheus'> <condition name='disabled_if_in' source='addTargetPrometheus'>
<param>non</param> <param>non</param>
<target type='variable'>prCli</target> <target type='variable'>prTarg</target>
<target type='variable'>prCliIP</target> <target type='variable'>prTargIP</target>
<target type='variable'>prCliSonde</target> <target type='variable'>prTargSonde</target>
</condition> </condition>
<condition name='disabled_if_in' source='addPrOpenCli'> <condition name='disabled_if_in' source='addPrOpenTarg'>
<param>non</param> <param>non</param>
<target type='variable'>prOpenCli</target> <target type='variable'>prOpenTarg</target>
<target type='variable'>prOpenCliIP</target> <target type='variable'>prOpenTargIP</target>
<target type='variable'>prOpenCliPort</target> <target type='variable'>prOpenTargPort</target>
</condition> </condition>
</constraints> </constraints>
<help> <help>

View File

@ -73,7 +73,7 @@ _EOF_
# rm -rf ${tmpFile} # rm -rf ${tmpFile}
} }
grafanaHost=$(CreoleGet srvGrafanaIP 192.168.30.57) grafanaHost=$(CreoleGet srvGrafanaIP 127.0.0.1)
grafanaPort=$(CreoleGet srvGrafanaPort 3000) grafanaPort=$(CreoleGet srvGrafanaPort 3000)
grafanaUser="admin" grafanaUser="admin"
grafanaPasswd=$(CreoleGet grafana_admin_passwd admin) grafanaPasswd=$(CreoleGet grafana_admin_passwd admin)

View File

@ -18,29 +18,40 @@ scrape_configs:
%end if %end if
] ]
- job_name: '%%job_name_node' - job_name: '%%job_name_node'
file_sd_configs: file_sd_configs:
- files: [ "%%job_file_config/*.yml" ] - files: [ "%%job_file_config/*.yml" ]
%if %%is_empty('ajout_client_prometheus') or %%is_empty('addPrOpenCli') %if %%getVar('addTargetPrometheus','non') == 'oui'
# Nothing to configure
%else
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
%if %%getVar('addPrOpenCli','non') == 'oui'
%for %%cliOpen in %%getVar('prOpenCli',[])
, '%%cliOpen.prOpenCliIP:%%cliOpen.prOpenCliPort'%slurp
%end for
%end if
] ]
%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}s
scrape_timeout: %%{job.scrpTimeout}s
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' %if %%getVar('activerAlertmanager','non') == 'oui'
alerting: alerting:
alertmanagers: alertmanagers: