Improve configuration flexibility to match prometheus way of doing
things
This commit is contained in:
parent
e3a6295709
commit
ab479fd33a
|
@ -2,7 +2,7 @@
|
|||
<creole>
|
||||
<files>
|
||||
<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'/>
|
||||
|
||||
<service>prometheus</service>
|
||||
|
@ -18,20 +18,20 @@
|
|||
</files>
|
||||
<variables>
|
||||
<family name='services'>
|
||||
<variable name='activer_prometheus' type='oui/non' description="Activer le service prometheus sur le serveur">
|
||||
<value>oui</value>
|
||||
<variable name='activer_prometheus' type='oui/non' description="Activer le service prometheus sur le serveur">
|
||||
<value>oui</value>
|
||||
</variable>
|
||||
</family>
|
||||
</family>
|
||||
<family name='prometheus'>
|
||||
<variable name='activer_grafana' type='oui/non' description="Activer le service grafana sur le serveur">
|
||||
<value>oui</value>
|
||||
</variable>
|
||||
<variable name='activerAlertmanager' type='oui/non' description="Activer le service d'alertes">
|
||||
<value>oui</value>
|
||||
</variable>
|
||||
<variable name='prometheusJobName' type='string' description="Nom du job ajouté au label">
|
||||
<variable name='activer_grafana' type='oui/non' description="Activer le service grafana sur le serveur">
|
||||
<value>oui</value>
|
||||
</variable>
|
||||
<variable name='activerAlertmanager' type='oui/non' description="Activer le service d'alertes">
|
||||
<value>oui</value>
|
||||
</variable>
|
||||
<variable name='prometheusJobName' type='string' description="Nom du job ajouté au label">
|
||||
<value>prometheus</value>
|
||||
</variable>
|
||||
</variable>
|
||||
<variable name='prometheusScrapeInterval' type='string' description="Intervalle de récupération des données sur les différents noeuds">
|
||||
<value>15s</value>
|
||||
</variable>
|
||||
|
@ -41,88 +41,106 @@
|
|||
<variable name='prometheusScrapeTimeout' type='string' description="Temps d'attente avant que la récupération de données échoue">
|
||||
<value>10s</value>
|
||||
</variable>
|
||||
<variable name='job_name_node' type='string' description="Nom du job pour les noeuds" mode='expert'>
|
||||
<value>node</value>
|
||||
</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_name_node' type='string' description="Nom du job pour les noeuds" mode='expert'>
|
||||
<value>node</value>
|
||||
</variable>
|
||||
<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">
|
||||
<family name='Jobs prometheus'>
|
||||
<variable name='promJobs' type='string' description="Nom du job prometheus"/>
|
||||
<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='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">
|
||||
|
||||
<!-- 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='addPrOpenCli' type='oui/non' description="Ajouter un client personnalisé">
|
||||
<variable name='addPrOpenTarg' type='oui/non' description="Ajouter un client 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>
|
||||
</variable>
|
||||
<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 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"/>
|
||||
<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>
|
||||
</variable>
|
||||
<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 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='alReceiverEmail' type='string' description="Adresse email du destinataire"/>
|
||||
<variable name='alReceiver' type='string' description="Nom du destinataire" multi='True'/>
|
||||
<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='alRouteMatchSource' type='string' description='Source de correspondance'/>
|
||||
<variable name='alRouteMatchValue' type='string' description='Valeur attendue'/>
|
||||
<variable name='alRouteMatchReceiver' type='string' description="Nom du destinataire de l'alerte"/>
|
||||
<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='alRouteMatchValue' type='string' description='Valeur attendue'/>
|
||||
<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='alRouteMatchRegExpSource' type='string' description='Source de correspondance'/>
|
||||
<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='alRouteRegxp' type='string' description="Rêgle de distribution des alertes" multi="True"/>
|
||||
<variable name='alRouteMatchRegExpSource' type='string' description='Source de correspondance'/>
|
||||
<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='alSubRoute' type='string' description="Nom de la rêgle maitresse" multi='True'/>
|
||||
<variable name='alSubRouteMatchSource' type='string' description='Source de correspondance'/>
|
||||
<variable name='alSubRouteMatchValue' type='string' description='Valeur attendue'/>
|
||||
<variable name='alSubRouteMatchReceiver' type='string' description="Nom du destinataire de l'alerte"/>
|
||||
<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='alSubRouteMatchValue' type='string' description='Valeur attendue'/>
|
||||
<variable name='alSubRouteMatchReceiver' type='string' description="Nom du destinataire de l'alerte"/>
|
||||
</family>
|
||||
|
||||
<separators>
|
||||
<separator name='activer_grafana'>Services complèmentairse</separator>
|
||||
<separator name='prometheusJobName'>Configuration du serveur Prometheus</separator>
|
||||
<separator name='activer_grafana'>Services complèmentairse</separator>
|
||||
<separator name='prometheusJobName'>Configuration du serveur Prometheus</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,20 +173,26 @@
|
|||
<slave>alSubRouteMatchReceiver</slave>
|
||||
</group>
|
||||
|
||||
<group master='prCli'>
|
||||
<slave>prCliIP</slave>
|
||||
<slave>prCliSonde</slave>
|
||||
<group master='prTarg'>
|
||||
<slave>prTargIP</slave>
|
||||
<slave>prTargJob</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'>
|
||||
<check name='valid_enum' target='prTargSonde'>
|
||||
<param>['Node Exporter','Port']</param>
|
||||
</check>
|
||||
|
||||
<check name='valid_enum' target='scrpScheme'>
|
||||
<param>['http','https']</param>
|
||||
</check>
|
||||
|
||||
<check name='valid_enum' target='alRouteMatchSource'>
|
||||
<param>['','service','severity']</param>
|
||||
</check>
|
||||
|
@ -208,17 +232,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>
|
||||
|
|
|
@ -18,12 +18,12 @@ 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'
|
||||
|
@ -33,14 +33,27 @@ scrape_configs:
|
|||
%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
|
||||
scrape_timeout: %%job.scrpTimeout
|
||||
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:
|
||||
|
|
Loading…
Reference in New Issue