Browse Source

Support multiple monit alert mails, for eg. pushover.

Thomas Buck 5 years ago
parent
commit
aa6a5e90e9

+ 4
- 0
group_vars/sovereign View File

46
 irc_realname: (required)
46
 irc_realname: (required)
47
 irc_quitmsg: (required)
47
 irc_quitmsg: (required)
48
 
48
 
49
+monit_alert_emails:
50
+  - "{{ admin_email }}"
51
+#  - "PUSHOVER_KEY@pomail.net"
52
+
49
 # openvpn
53
 # openvpn
50
 openvpn_clients:
54
 openvpn_clients:
51
   - laptop
55
   - laptop

+ 4
- 0
roles/monitoring/defaults/main.yml View File

6
 monit_admin_username: "{{ main_user_name }}"
6
 monit_admin_username: "{{ main_user_name }}"
7
 monit_admin_password: "{{ lookup('password', secret + '/' + 'monit_admin_password length=16 chars=hexdigits') }}"
7
 monit_admin_password: "{{ lookup('password', secret + '/' + 'monit_admin_password length=16 chars=hexdigits') }}"
8
 
8
 
9
+# could be used for example with the pushover.net e-mail notification API
10
+monit_alert_emails:
11
+  - "{{ admin_email }}"
12
+
9
 monit_page_public: 1
13
 monit_page_public: 1
10
 monit_subdomain: status
14
 monit_subdomain: status

+ 6
- 11
roles/monitoring/templates/etc_monit_monitrc.j2 View File

106
 
106
 
107
 set mail-format {
107
 set mail-format {
108
      from: monit@{{ domain }}
108
      from: monit@{{ domain }}
109
-  subject: monit alert --  $EVENT $SERVICE
110
-  message: $EVENT Service $SERVICE
111
-
112
-    Date:        $DATE
113
-    Action:      $ACTION
114
-    Host:        $HOST
115
-    Description: $DESCRIPTION
116
-
117
-Your faithful employee,
118
-Monit from Sovereign
109
+  subject: monit alert $HOST
110
+  message: $EVENT $SERVICE
111
+$DESCRIPTION
119
 }
112
 }
120
 
113
 
121
 #
114
 #
128
 #                                                # timeout alert
121
 #                                                # timeout alert
129
 #
122
 #
130
 
123
 
131
-set alert {{ admin_email }}
124
+{% for mail in monit_alert_emails %}
125
+set alert {{ mail }}
126
+{% endfor %}
132
 
127
 
133
 #
128
 #
134
 ## Monit has an embedded web server which can be used to view status of
129
 ## Monit has an embedded web server which can be used to view status of

Loading…
Cancel
Save