Browse Source

Improving dico to be more Prometheus like

We need to be closer to the prometheus way to do things
2.6.2/master
Philippe Caseiro 1 year ago
parent
commit
e95d6f9e1d
2 changed files with 28 additions and 25 deletions
  1. 21
    16
      dicos/70_prometheus.xml
  2. 7
    9
      tmpl/prometheus.yml

+ 21
- 16
dicos/70_prometheus.xml View File

@@ -47,9 +47,19 @@
47 47
             <variable name='job_file_config' type='string' description="Emplacement des fichiers de configuration des noeuds" auto_freeze='True' mode='expert' mandatory='True'>
48 48
                 <value>/etc/prometheus/nodes</value>
49 49
             </variable>
50
+            <variable name='addTargetPrometheus' type='oui/non' description="Ajouter des cibles statiques à Prometheus">
51
+                <value>non</value>
52
+            </variable>
53
+
54
+            <!-- Job standard  -->
55
+            <variable name='prTarg' type='string' description='Nom de la cible prometheus' multi='True'/>
56
+            <variable name='prTargIP' type='ip' description="Adresse IP de la cible prometheus"/>
57
+            <variable name='prTargSonde' type='string' description="Sonde a utiliser pour ce client">
58
+                <value>Node Exporter</value>
59
+            </variable>
50 60
         </family>
51 61
         <family name='Jobs prometheus'>
52
-            <variable name='promJobs' type='string' description="Nom du job prometheus"/>
62
+            <variable name='promJobs' type='string' description="Nom du job prometheus" multi='True'/>
53 63
             <variable name='honorLabels' type='oui/non' description='Garder les labels en cas de conflit' mode='expert'>
54 64
                 <value>oui</value>
55 65
             </variable>
@@ -63,19 +73,7 @@
63 73
                 <value>http</value>
64 74
             </variable>
65 75
 
66
-            <variable name='addTargetPrometheus' type='oui/non' description="Ajouter des cibles statiques à Prometheus">
67
-                <value>non</value>
68
-            </variable>
69
-
70
-            <!-- Job standard  -->
71
-            <variable name='prTarg' type='string' description='Nom de la cible prometheus' multi='True'/>
72
-            <variable name='prTargJob' type='string' description='Nom du job de rattachement de la cible'/>
73
-            <variable name='prTargIP' type='ip' description="Adresse IP de la cible prometheus"/>
74
-            <variable name='prTargSonde' type='string' description="Sonde a utiliser pour ce client">
75
-                <value>Node Exporter</value>
76
-            </variable>
77
-
78
-            <variable name='addPrOpenTarg' type='oui/non' description="Ajouter un client personnalisé">
76
+            <variable name='addPrOpenTarg' type='oui/non' description="Ajouter des cibles statiques pour les jobs personnalisé">
79 77
                 <value>non</value>
80 78
             </variable>
81 79
             <!-- Job libre  -->
@@ -141,6 +139,7 @@
141 139
     <separators>
142 140
         <separator name='activer_grafana'>Services complèmentairse</separator>
143 141
         <separator name='prometheusJobName'>Configuration du serveur Prometheus</separator>
142
+		<separator name='job_name_node'>Configuration des jobs standards</separator>
144 143
         <separator name='alSMTPHost'>Configuration SMTP pour l'envois des alertes</separator>
145 144
         <separator name='alReceiver'>Destinatires</separator>
146 145
         <separator name='alRoute'>Rêgles de distribution simples</separator>
@@ -155,6 +154,13 @@
155 154
             <slave>alReceiverEmail</slave>
156 155
         </group>
157 156
 
157
+        <group master='promJobs'>
158
+            <slave>scrpInterval</slave>
159
+            <slave>scrpTimeout</slave>
160
+            <slave>honorLabels</slave>
161
+			<slave>scrpScheme</slave>
162
+        </group>
163
+
158 164
         <group master='alRoute'>
159 165
             <slave>alRouteMatchSource</slave>
160 166
             <slave>alRouteMatchValue</slave>
@@ -175,7 +181,6 @@
175 181
 
176 182
         <group master='prTarg'>
177 183
             <slave>prTargIP</slave>
178
-            <slave>prTargJob</slave>
179 184
             <slave>prTargSonde</slave>
180 185
         </group>
181 186
 
@@ -186,7 +191,7 @@
186 191
         </group>
187 192
 
188 193
         <check name='valid_enum' target='prTargSonde'>
189
-            <param>['Node Exporter','Port']</param>
194
+            <param>['Node Exporter']</param>
190 195
         </check>
191 196
 
192 197
         <check name='valid_enum' target='scrpScheme'>

+ 7
- 9
tmpl/prometheus.yml View File

@@ -26,25 +26,23 @@ scrape_configs:
26 26
 %if %%getVar('addTargetPrometheus','non') == 'oui'
27 27
     static_configs:
28 28
         - targets: [ "%%adresse_ip_eth0:9100"%slurp
29
-    %if %%getVar('ajout_client_prometheus','non') == 'oui'
30
-        %for %%cliPr in %%getVar('prCli',[])
31
-            %if %%cliPr.prCliSonde == 'Node Exporter'
32
-, '%%cliPr.prCliIP:9100'%slurp
29
+        %for %%cliPr in %%getVar('prTarg',[])
30
+            %if %%cliPr.prTargSonde == 'Node Exporter'
31
+, '%%cliPr.prTargIP:9100'%slurp
33 32
             %end if
34 33
         %end for
35
-    %end if
36 34
 ]
37 35
 %end if
38 36
 
39
-%for %%job in %%getVar['promJobs',[]]
37
+%for %%job in %%getVar('promJobs', [])
40 38
   - job_name: '%%job'
41 39
   %if %%job.honorLabels == 'oui'
42 40
     honor_labels: true
43 41
   %else
44
-    honor_labels; false
42
+    honor_labels: false
45 43
   %end if
46
-    scrape_interval: %%job.scrpInterval
47
-    scrape_timeout: %%job.scrpTimeout
44
+    scrape_interval: %%{job.scrpInterval}s
45
+    scrape_timeout: %%{job.scrpTimeout}s
48 46
     scheme: %%job.scrpScheme
49 47
   %for %%target in %%getVar('prOpenTarg',[])
50 48
     static_configs:

Loading…
Cancel
Save