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

@ -2,7 +2,7 @@
<creole> <creole>
<files> <files>
<file filelist='prometheus' name='/etc/prometheus/prometheus.yml' mkdir='True' rm='True'/> <file filelist='prometheus' name='/etc/prometheus/prometheus.yml' mkdir='True' rm='True'/>
<file filelist='alertmanager' name='/etc/prometheus/alertmanager.yml' mkdir='True' rm='True'/> <file filelist='alertmanager' name='/etc/prometheus/alertmanager.yml' mkdir='True' rm='True'/>
<file filelist='grafana' name='/etc/grafana/grafana.ini' mkdir='True' rm='True'/> <file filelist='grafana' name='/etc/grafana/grafana.ini' mkdir='True' rm='True'/>
<service>prometheus</service> <service>prometheus</service>
@ -18,20 +18,20 @@
</files> </files>
<variables> <variables>
<family name='services'> <family name='services'>
<variable name='activer_prometheus' type='oui/non' description="Activer le service prometheus sur le serveur"> <variable name='activer_prometheus' type='oui/non' description="Activer le service prometheus sur le serveur">
<value>oui</value> <value>oui</value>
</variable> </variable>
</family> </family>
<family name='prometheus'> <family name='prometheus'>
<variable name='activer_grafana' type='oui/non' description="Activer le service grafana sur le serveur"> <variable name='activer_grafana' type='oui/non' description="Activer le service grafana sur le serveur">
<value>oui</value> <value>oui</value>
</variable> </variable>
<variable name='activerAlertmanager' type='oui/non' description="Activer le service d'alertes"> <variable name='activerAlertmanager' type='oui/non' description="Activer le service d'alertes">
<value>oui</value> <value>oui</value>
</variable> </variable>
<variable name='prometheusJobName' type='string' description="Nom du job ajouté au label"> <variable name='prometheusJobName' type='string' description="Nom du job ajouté au label">
<value>prometheus</value> <value>prometheus</value>
</variable> </variable>
<variable name='prometheusScrapeInterval' type='string' description="Intervalle de récupération des données sur les différents noeuds"> <variable name='prometheusScrapeInterval' type='string' description="Intervalle de récupération des données sur les différents noeuds">
<value>15s</value> <value>15s</value>
</variable> </variable>
@ -41,88 +41,105 @@
<variable name='prometheusScrapeTimeout' type='string' description="Temps d'attente avant que la récupération de données échoue"> <variable name='prometheusScrapeTimeout' type='string' description="Temps d'attente avant que la récupération de données échoue">
<value>10s</value> <value>10s</value>
</variable> </variable>
<variable name='job_name_node' type='string' description="Nom du job pour les noeuds" mode='expert'> <variable name='job_name_node' type='string' description="Nom du job pour les noeuds" mode='expert'>
<value>node</value> <value>node</value>
</variable> </variable>
<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'/> <!-- Job standard -->
<variable name='prCliIP' type='ip' description="Adresse IP du client prometheus"/> <variable name='prTarg' type='string' description='Nom de la cible prometheus' multi='True'/>
<variable name='prCliSonde' type='string' description="Sonde a utiliser pour ce client"> <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> <value>Node Exporter</value>
</variable> </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='addPrOpenCli' 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> <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">
<variable name='grafana_domain' type='string' description="Nom de Domaine ou IP pour accèder à l'interface Grafana" mandatory='True'> <family name="grafana">
<value>localhost</value> <variable name='grafana_domain' type='string' description="Nom de Domaine ou IP pour accèder à l'interface Grafana" mandatory='True'>
</variable> <value>localhost</value>
<variable name='grafana_session_max_lifetime' type='string' description="Durée avant déconnexion de l'interface Grafana (en seconde)"> </variable>
<value>86400</value> <variable name='grafana_session_max_lifetime' type='string' description="Durée avant déconnexion de l'interface Grafana (en seconde)">
<value>86400</value>
</variable>
<variable name='grafana_admin_passwd' type='string' description="Mot de passe admin pour la première connexion">
<value>admin</value>
</variable>
<variable name='grafana_sign_up' type='string' description="Activer l'enregistrement automatique">
<value>false</value>
</variable>
<variable name='grafana_auth_anonymous' type='string' description="Activer l'accès aux utilisateurs non enregistrés">
<value>false</value>
</variable>
</family>
<family name="alertes prometheus">
<variable name='alSMTPHost' type='string' description="Adresse du serveur SMTP pour l'envois des alertes"/>
<variable name='alSMTPPort' type='string' description="Port d'écoute du serveur SMTP pour l'envois des alertes"/>
<variable name='alFrom' type='string' description="Adresse d'origine des emails d'alerte"/>
<variable name='alSMTPTLS' type='oui/non' description="Utiliser STARTTLS">
<value>non</value>
</variable> </variable>
<variable name='grafana_admin_passwd' type='string' description="Mot de passe admin pour la première connexion"> <variable name='alSMTPAuth' type='oui/non' description="Authentification requise sur le serveur SMTP ?">
<value>admin</value> <value>non</value>
</variable> </variable>
<variable name='grafana_sign_up' type='string' description="Activer l'enregistrement automatique"> <variable name='alSMTPUser' type='string' description="Utilisateur SMTP"/>
<value>false</value> <variable name='alSMTPPass' type='string' description="Mot de passe"/>
</variable>
<variable name='grafana_auth_anonymous' type='string' description="Activer l'accès aux utilisateurs non enregistrés">
<value>false</value>
</variable>
</family>
<family name="alertes prometheus">
<variable name='alSMTPHost' type='string' description="Adresse du serveur SMTP pour l'envois des alertes"/>
<variable name='alSMTPPort' type='string' description="Port d'écoute du serveur SMTP pour l'envois des alertes"/>
<variable name='alFrom' type='string' description="Adresse d'origine des emails d'alerte"/>
<variable name='alSMTPTLS' type='oui/non' description="Utiliser STARTTLS">
<value>non</value>
</variable>
<variable name='alSMTPAuth' type='oui/non' description="Authentification requise sur le serveur SMTP ?">
<value>non</value>
</variable>
<variable name='alSMTPUser' type='string' description="Utilisateur SMTP"/>
<variable name='alSMTPPass' type='string' description="Mot de passe"/>
<variable name='alReceiver' type='string' description="Nom du destinataire" multi='True'/> <variable name='alReceiver' type='string' description="Nom du destinataire" multi='True'/>
<variable name='alReceiverEmail' type='string' description="Adresse email du destinataire"/> <variable name='alReceiverEmail' type='string' description="Adresse email du destinataire"/>
<variable name='alDefaultReceiver' type='string' description='Nom du destinataire par défaut'/> <variable name='alDefaultReceiver' type='string' description='Nom du destinataire par défaut'/>
<variable name='alRoute' type='string' description="Nom de la rêgle de distribution des alertes" multi="True"/> <variable name='alRoute' type='string' description="Nom de la rêgle de distribution des alertes" multi="True"/>
<variable name='alRouteMatchSource' type='string' description='Source de correspondance'/> <variable name='alRouteMatchSource' type='string' description='Source de correspondance'/>
<variable name='alRouteMatchValue' type='string' description='Valeur attendue'/> <variable name='alRouteMatchValue' type='string' description='Valeur attendue'/>
<variable name='alRouteMatchReceiver' type='string' description="Nom du destinataire de l'alerte"/> <variable name='alRouteMatchReceiver' type='string' description="Nom du destinataire de l'alerte"/>
<variable name='alRouteRegxp' type='string' description="Rêgle de distribution des alertes" multi="True"/> <variable name='alRouteRegxp' type='string' description="Rêgle de distribution des alertes" multi="True"/>
<variable name='alRouteMatchRegExpSource' type='string' description='Source de correspondance'/> <variable name='alRouteMatchRegExpSource' type='string' description='Source de correspondance'/>
<variable name='alRouteMatchRegExp' type='string' description='Expression régulière'/> <variable name='alRouteMatchRegExp' type='string' description='Expression régulière'/>
<variable name='alRouteMatchRegxpRecv' type='string' description="Nom du destinataire de l'alerte (regxp)"/> <variable name='alRouteMatchRegxpRecv' type='string' description="Nom du destinataire de l'alerte (regxp)"/>
<variable name='alSubRoute' type='string' description="Nom de la rêgle maitresse" multi='True'/> <variable name='alSubRoute' type='string' description="Nom de la rêgle maitresse" multi='True'/>
<variable name='alSubRouteMatchSource' type='string' description='Source de correspondance'/> <variable name='alSubRouteMatchSource' type='string' description='Source de correspondance'/>
<variable name='alSubRouteMatchValue' type='string' description='Valeur attendue'/> <variable name='alSubRouteMatchValue' type='string' description='Valeur attendue'/>
<variable name='alSubRouteMatchReceiver' type='string' description="Nom du destinataire de l'alerte"/> <variable name='alSubRouteMatchReceiver' type='string' description="Nom du destinataire de l'alerte"/>
</family> </family>
<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: