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'>
<value>/etc/prometheus/nodes</value>
</variable>
</family>
<family name='Clients prometheus'>
<variable name='ajout_client_prometheus' type='oui/non' description="Ajouter un nouveau client à Prometheus">
<variable name='addTargetPrometheus' type='oui/non' description="Ajouter des cibles statiques à Prometheus">
<value>non</value>
</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>
</variable>
<!-- Client libre -->
<variable name='prOpenCli' type='string' description='Nom du client personnalisé prometheus' multi='True'/>
<variable name='prOpenCliIP' type='ip' description="Adresse IP"/>
<variable name='prOpenCliPort' type='number' description="Port d'écoute de la sonde"/>
<!-- Job libre -->
<variable name='prOpenTarg' type='string' description='Nom de la cible personnalisé prometheus' multi='True'/>
<variable name='prOpenTargJob' type='string' description='Nom du job de rattachement de la cible'/>
<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 name="grafana">
<variable name='grafana_domain' type='string' description="Nom de Domaine ou IP pour accèder à l'interface Grafana" mandatory='True'>
<value>localhost</value>
@ -123,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>
@ -137,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>
@ -155,18 +179,23 @@
<slave>alSubRouteMatchReceiver</slave>
</group>
<group master='prCli'>
<slave>prCliIP</slave>
<slave>prCliSonde</slave>
<group master='prTarg'>
<slave>prTargIP</slave>
<slave>prTargSonde</slave>
</group>
<group master='prOpenCli'>
<slave>prOpenCliIP</slave>
<slave>prOpenCliPort</slave>
<group master='prOpenTarg'>
<slave>prOpenTargIP</slave>
<slave>prOpenTargPort</slave>
<slave>prOpenTargJob</slave>
</group>
<check name='valid_enum' target='prCliSonde'>
<param>['Node Exporter','Port']</param>
<check name='valid_enum' target='prTargSonde'>
<param>['Node Exporter']</param>
</check>
<check name='valid_enum' target='scrpScheme'>
<param>['http','https']</param>
</check>
<check name='valid_enum' target='alRouteMatchSource'>
@ -208,17 +237,17 @@
<target type='service_accesslist'>alertmanager</target>
</condition>
<condition name='disabled_if_in' source='ajout_client_prometheus'>
<condition name='disabled_if_in' source='addTargetPrometheus'>
<param>non</param>
<target type='variable'>prCli</target>
<target type='variable'>prCliIP</target>
<target type='variable'>prCliSonde</target>
<target type='variable'>prTarg</target>
<target type='variable'>prTargIP</target>
<target type='variable'>prTargSonde</target>
</condition>
<condition name='disabled_if_in' source='addPrOpenCli'>
<condition name='disabled_if_in' source='addPrOpenTarg'>
<param>non</param>
<target type='variable'>prOpenCli</target>
<target type='variable'>prOpenCliIP</target>
<target type='variable'>prOpenCliPort</target>
<target type='variable'>prOpenTarg</target>
<target type='variable'>prOpenTargIP</target>
<target type='variable'>prOpenTargPort</target>
</condition>
</constraints>
<help>

View File

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

View File

@ -18,29 +18,40 @@ 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'
%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
%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}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'
alerting:
alertmanagers: