Philippe Caseiro 11 months ago
parent
commit
d815f156e3
2 changed files with 10 additions and 1 deletions
  1. 7
    1
      dicos/70_prometheus.xml
  2. 3
    0
      tmpl/prometheus.yml

+ 7
- 1
dicos/70_prometheus.xml View File

@@ -52,6 +52,7 @@
52 52
 			<variable name='prCliSonde' type='string' description="Sonde a utiliser pour ce client">
53 53
 				<value>Node Exporter</value>
54 54
 			</variable>
55
+			<variable name='prCliPort' type='number' description="Port d'écoute de la sonde du client"/>
55 56
         </family>
56 57
     <family name="grafana">
57 58
         <variable name='grafana_domain' type='string' description="Nom de Domaine ou IP pour accèder à l'interface Grafana" mandatory='True'>
@@ -78,7 +79,7 @@
78 79
 		</group>
79 80
 
80 81
 		<check name='valid_enum' target='prCliSonde'>
81
-			<param>['Node Exporter']</param>
82
+			<param>['Node Exporter','Port']</param>
82 83
 		</check>
83 84
 
84 85
         <condition name='disabled_if_in' source='activer_prometheus'>
@@ -97,7 +98,12 @@
97 98
             <target type='variable'>prCli</target>
98 99
             <target type='variable'>prCliIP</target>
99 100
             <target type='variable'>prCliSonde</target>
101
+            <target type='variable'>prCliPort</target>
100 102
         </condition>
103
+		<condition name='disabled_if_not_in' source='prCliSonde'>
104
+			<param>Port</param>
105
+			<target type='variable'>prCliPort</target>
106
+		</condition>
101 107
     </constraints>
102 108
     <help>
103 109
     </help>

+ 3
- 0
tmpl/prometheus.yml View File

@@ -26,6 +26,9 @@ scrape_configs:
26 26
     %if %%cliPr.prCliSonde == 'Node Exporter'
27 27
       - targets: ['%%cliPr.prCliIP:9100']
28 28
     %end if
29
+    %if %%cliPr.prCliSonde == 'Port'
30
+      - targets: ['%%cliPr.prCliIP:%%cliPr.prCliPort']
31
+    %end if
29 32
   %end for
30 33
 %end if
31 34