Browse Source

Enable E-Mail notifications from Monit

Thomas Buck 5 years ago
parent
commit
013c5ac0fa

+ 1
- 1
roles/monitoring/tasks/monit.yml View File

13
     - dependencies
13
     - dependencies
14
 
14
 
15
 - name: Copy monit master config file into place
15
 - name: Copy monit master config file into place
16
-  copy: src=etc_monit_monitrc dest=/etc/monit/monitrc
16
+  template: src=etc_monit_monitrc.j2 dest=/etc/monit/monitrc
17
   notify: restart monit
17
   notify: restart monit
18
 
18
 
19
 - name: Determine if ZNC is installed
19
 - name: Determine if ZNC is installed

roles/monitoring/files/etc_monit_monitrc → roles/monitoring/templates/etc_monit_monitrc.j2 View File

103
 #
103
 #
104
 # set mail-format { from: monit@foo.bar }
104
 # set mail-format { from: monit@foo.bar }
105
 #
105
 #
106
+
107
+set mail-format {
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
119
+}
120
+
106
 #
121
 #
107
 ## You can set alert recipients whom will receive alerts if/when a
122
 ## You can set alert recipients whom will receive alerts if/when a
108
 ## service defined in this file has errors. Alerts may be restricted on
123
 ## service defined in this file has errors. Alerts may be restricted on
112
 # set alert manager@foo.bar only on { timeout }  # receive just service-
127
 # set alert manager@foo.bar only on { timeout }  # receive just service-
113
 #                                                # timeout alert
128
 #                                                # timeout alert
114
 #
129
 #
130
+
131
+set alert {{ admin_email }}
132
+
115
 #
133
 #
116
 ## Monit has an embedded web server which can be used to view status of
134
 ## Monit has an embedded web server which can be used to view status of
117
 ## services monitored and manage services from a web interface. See the
135
 ## services monitored and manage services from a web interface. See the
118
 ## Monit Wiki if you want to enable SSL for the web server.
136
 ## Monit Wiki if you want to enable SSL for the web server.
119
 #
137
 #
138
+
120
 set httpd port 2812 and
139
 set httpd port 2812 and
121
     use address localhost  # only accept connection from localhost
140
     use address localhost  # only accept connection from localhost
122
     allow localhost        # allow localhost to connect to the server and
141
     allow localhost        # allow localhost to connect to the server and
123
     allow admin:monit      # require user 'admin' with password 'monit'
142
     allow admin:monit      # require user 'admin' with password 'monit'
143
+
124
 #    allow @monit           # allow users of group 'monit' to connect (rw)
144
 #    allow @monit           # allow users of group 'monit' to connect (rw)
125
 #    allow @users readonly  # allow users of group 'users' to connect readonly
145
 #    allow @users readonly  # allow users of group 'users' to connect readonly
126
 #
146
 #

Loading…
Cancel
Save