Browse Source

Improving alerting configuration

fix-conf
Philippe Caseiro 1 year ago
parent
commit
4195adfa6e
3 changed files with 19 additions and 11 deletions
  1. 5
    2
      dicos/70_prometheus.xml
  2. 6
    1
      tmpl/alertmanager.yml
  3. 8
    8
      tmpl/prometheus.yml

+ 5
- 2
dicos/70_prometheus.xml View File

@@ -9,9 +9,8 @@
9 9
         <service>alertmanager</service>
10 10
         <service>grafana-server</service>
11 11
         <service_access service='prometheus'>
12
-            <port service_accesslist="saLemon">80</port>
13
-            <port service_accesslist="saLemon">443</port>
14 12
             <port service_accesslist="prometheus">9090</port>
13
+            <port service_accesslist="alertmanager">9093</port>
15 14
         </service_access>
16 15
         <service_access service='grafana-server'>
17 16
             <port service_accesslist="grafana">3000</port>
@@ -90,6 +89,9 @@
90 89
         <variable name='alSMTPHost' type='string' description="Adresse du serveur SMTP pour l'envois des alertes"/>
91 90
         <variable name='alSMTPPort' type='string' description="Port d'écoute du serveur SMTP pour l'envois des alertes"/>
92 91
         <variable name='alFrom' type='string' description="Adresse d'origine des emails d'alerte"/>
92
+		<variable name='alSMTPTLS' type='oui/non' description="Utiliser STARTTLS">
93
+			<value>non</value>
94
+		</variable>
93 95
         <variable name='alSMTPAuth' type='oui/non' description="Authentification requise sur le serveur SMTP ?">
94 96
             <value>non</value>
95 97
         </variable>
@@ -191,6 +193,7 @@
191 193
             <param>non</param>
192 194
             <target type='family'>alertes prometheus</target>
193 195
             <target type='filelist'>alertmanager</target>
196
+            <target type='service_accesslist'>alertmanager</target>
194 197
         </condition>
195 198
 
196 199
         <condition name='disabled_if_in' source='ajout_client_prometheus'>

+ 6
- 1
tmpl/alertmanager.yml View File

@@ -6,6 +6,11 @@ global:
6 6
   smtp_auth_username: '%%alSMTPUser'
7 7
   smtp_auth_password: 'alSMTPPass'
8 8
 %end if
9
+%ïf %%getVar('alSMTPTLS','non') == 'oui'
10
+  smtp_require_tls: true
11
+%else
12
+  smtp_require_tls: false
13
+%end if
9 14
   # The auth token for Hipchat.
10 15
   #hipchat_auth_token: '1234556789'
11 16
   # Alternative host for Hipchat.
@@ -25,7 +30,7 @@ route:
25 30
   # When a new group of alerts is created by an incoming alert, wait at
26 31
   # least 'group_wait' to send the initial notification.
27 32
   # This way ensures that you get multiple alerts for the same group that start
28
-  # firing shortly after another are batched together on the first 
33
+  # firing shortly after another are batched together on the first
29 34
   # notification.
30 35
   group_wait: 30s
31 36
 

+ 8
- 8
tmpl/prometheus.yml View File

@@ -41,11 +41,11 @@ scrape_configs:
41 41
 ]
42 42
 %end if
43 43
 
44
-#alerting:
45
-#  alertmanagers:
46
-#  - scheme: https
47
-#    static_configs:
48
-#    - targets:
49
-#      - "1.2.3.4:9093"
50
-#      - "1.2.3.5:9093"
51
-#      - "1.2.3.6:9093"
44
+%if %%getVar('activerAlertmanager','non') == 'oui'
45
+alerting:
46
+  alertmanagers:
47
+  - scheme: http
48
+    static_configs:
49
+    - targets:
50
+       - "%%nom_domaine_machine:9093"
51
+%end if

Loading…
Cancel
Save