Browse Source

Improving alert support

Philippe Caseiro 11 months ago
parent
commit
5ab3f20789
2 changed files with 11 additions and 3 deletions
  1. 9
    1
      dicos/70_prometheus.xml
  2. 2
    2
      tmpl/alertmanager.yml

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

@@ -122,7 +122,8 @@
122 122
 		<separator name='prometheusJobName'>Configuration du serveur Prometheus</separator>
123 123
         <separator name='alSMTPHost'>Configuration SMTP pour l'envois des alertes</separator>
124 124
         <separator name='alDefaultReceiver'>Destinatires</separator>
125
-        <separator name='alRoute'>Rêgles de distribution</separator>
125
+        <separator name='alRoute'>Rêgles de distribution simples</separator>
126
+        <separator name='alRouteRegxp'>Rêgles de distribution regexp</separator>
126 127
         <separator name='alSubRoute'>Sous-rêgles de distribution</separator>
127 128
     </separators>
128 129
 
@@ -165,6 +166,12 @@
165 166
             <param>['Node Exporter','Port']</param>
166 167
         </check>
167 168
 
169
+        <condition name='disabled_if_in' source='alSMTPAuth'>
170
+            <param>non</param>
171
+            <target type='variable'>alSMTPUser</target>
172
+            <target type='variable'>alSMTPPass</target>
173
+        </condition>
174
+
168 175
         <condition name='disabled_if_in' source='activer_prometheus'>
169 176
             <param>non</param>
170 177
             <target type='family'>prometheus</target>
@@ -172,6 +179,7 @@
172 179
             <target type='filelist'>prometheus</target>
173 180
             <target type='variable'>activer_grafana</target>
174 181
         </condition>
182
+
175 183
         <condition name='disabled_if_in' source='activer_grafana'>
176 184
             <param>non</param>
177 185
             <target type='family'>grafana</target>

+ 2
- 2
tmpl/alertmanager.yml View File

@@ -51,7 +51,7 @@ route:
51 51
   - match_re:
52 52
       %%{route.alRouteMatchRegExpSource}: %%{route.alRouteMatchRegExp}
53 53
       receiver: %%route.alRouteMatchRegxpRecv
54
-  %if not is_empty('alSubRoute')
54
+  %if not %%is_empty('alSubRoute')
55 55
     routes:
56 56
     %for sroute in %%getVar('alSubRoute',[])
57 57
     # The service has a sub-route for critical alerts, any alerts
@@ -70,7 +70,7 @@ route:
70 70
       %%{rt.alRouteMatchSource}: %%{rt.alRouteMatchValue}
71 71
     receiver: %%rt.alRouteMatchReceiver
72 72
 
73
-  %if not is_empty('alSubRoute')
73
+  %if not %%is_empty('alSubRoute')
74 74
     routes:
75 75
     %for sroute in %%getVar('alSubRoute',[])
76 76
       %if %%sroute == %%rt