Improve configuration flexibility to match prometheus way of doing
things
This commit is contained in:
parent
e3a6295709
commit
ab479fd33a
|
@ -48,25 +48,43 @@
|
||||||
<value>/etc/prometheus/nodes</value>
|
<value>/etc/prometheus/nodes</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<family name='Clients prometheus'>
|
<family name='Jobs prometheus'>
|
||||||
<variable name='ajout_client_prometheus' type='oui/non' description="Ajouter un nouveau client à 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>
|
<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='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>
|
<value>Node Exporter</value>
|
||||||
</variable>
|
</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>
|
<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>
|
||||||
|
@ -155,20 +173,26 @@
|
||||||
<slave>alSubRouteMatchReceiver</slave>
|
<slave>alSubRouteMatchReceiver</slave>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group master='prCli'>
|
<group master='prTarg'>
|
||||||
<slave>prCliIP</slave>
|
<slave>prTargIP</slave>
|
||||||
<slave>prCliSonde</slave>
|
<slave>prTargJob</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','Port']</param>
|
||||||
</check>
|
</check>
|
||||||
|
|
||||||
|
<check name='valid_enum' target='scrpScheme'>
|
||||||
|
<param>['http','https']</param>
|
||||||
|
</check>
|
||||||
|
|
||||||
<check name='valid_enum' target='alRouteMatchSource'>
|
<check name='valid_enum' target='alRouteMatchSource'>
|
||||||
<param>['','service','severity']</param>
|
<param>['','service','severity']</param>
|
||||||
</check>
|
</check>
|
||||||
|
@ -208,17 +232,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>
|
||||||
|
|
|
@ -18,12 +18,12 @@ 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'
|
%if %%getVar('ajout_client_prometheus','non') == 'oui'
|
||||||
|
@ -33,14 +33,27 @@ scrape_configs:
|
||||||
%end if
|
%end if
|
||||||
%end for
|
%end for
|
||||||
%end if
|
%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
|
||||||
|
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'
|
%if %%getVar('activerAlertmanager','non') == 'oui'
|
||||||
alerting:
|
alerting:
|
||||||
alertmanagers:
|
alertmanagers:
|
||||||
|
|
Loading…
Reference in New Issue