Browse Source

Supporting gobal smtp gateway usage

Philippe Caseiro 11 months ago
parent
commit
33643232d4
2 changed files with 29 additions and 4 deletions
  1. 13
    0
      dicos/70_prometheus.xml
  2. 16
    4
      tmpl/alertmanager.yml

+ 13
- 0
dicos/70_prometheus.xml View File

@@ -103,6 +103,9 @@
103 103
                 </family>
104 104
 
105 105
         <family name="alertes prometheus">
106
+			<variable name='alSMTPUseSys' type='oui/non' description="Utiliser la passerelle SMTP du système ?">
107
+				<value>non</value>
108
+			</variable>
106 109
             <variable name='alSMTPHost' type='string' description="Adresse du serveur SMTP pour l'envois des alertes"/>
107 110
             <variable name='alSMTPPort' type='string' description="Port d'écoute du serveur SMTP pour l'envois des alertes"/>
108 111
             <variable name='alFrom' type='string' description="Adresse d'origine des emails d'alerte"/>
@@ -211,6 +214,16 @@
211 214
             <param>['','service','severity']</param>
212 215
         </check>
213 216
 
217
+        <condition name='disabled_if_in' source='alSMTPUseSys'>
218
+            <param>oui</param>
219
+            <target type='variable'>alSMTPUser</target>
220
+            <target type='variable'>alSMTPPass</target>
221
+            <target type='variable'>alSMTPPort</target>
222
+            <target type='variable'>alSMTPTLS</target>
223
+			<target type='variable'>alSMTPHost</target>
224
+			<target type='variable'>alSMTPAuth</target>
225
+        </condition>
226
+
214 227
         <condition name='disabled_if_in' source='alSMTPAuth'>
215 228
             <param>non</param>
216 229
             <target type='variable'>alSMTPUser</target>

+ 16
- 4
tmpl/alertmanager.yml View File

@@ -1,16 +1,28 @@
1 1
 global:
2 2
   # The smarthost and SMTP sender used for mail notifications.
3
+%if %%alSMTPUseSys ==  'oui'
4
+  %if %%tls_smtp == "non"
5
+  smtp_smarthost: '%%exim_relay_smtp:25'
6
+  %elif %%tls_smtp == "port 25"
7
+  smtp_smarthost: '%%exim_relay_smtp:25'
8
+  smtp_require_tls: true
9
+  %else
10
+  smtp_smarthost: '%%exim_relay_smtp:465'
11
+  smtp_require_tls: true
12
+  %end if
13
+%else
3 14
   smtp_smarthost: '%%alSMTPHost:%%alSMTPPort'
4 15
   smtp_from: '%%alFrom'
5
-%if %%getVar('alSMTPAuth','non') == 'oui'
16
+  %if %%getVar('alSMTPAuth','non') == 'oui'
6 17
   smtp_auth_username: '%%alSMTPUser'
7 18
   smtp_auth_password: 'alSMTPPass'
8
-%end if
19
+  %end if
9 20
 
10
-%if %%getVar('alSMTPTLS','non') == 'oui'
21
+  %if %%getVar('alSMTPTLS','non') == 'oui'
11 22
   smtp_require_tls: true
12
-%else
23
+  %else
13 24
   smtp_require_tls: false
25
+  %end if
14 26
 %end if
15 27
 
16 28
   # The auth token for Hipchat.