Browse Source

Fix ZNC monit task socket. Fix all monit tasks start and stop program. add prosody, redis, rspamd and fathom monitoring.

Thomas Buck 5 years ago
parent
commit
0a78d445a2

+ 2
- 2
roles/monitoring/files/etc_monit_conf.d_apache2 View File

@@ -1,7 +1,7 @@
1 1
 check process apache2 with pidfile /var/run/apache2/apache2.pid
2 2
   group www
3
-  start program = "systemctl start apache2"
4
-  stop program = "systemctl stop apache2"
3
+  start program = "/bin/systemctl start apache2"
4
+  stop program = "/bin/systemctl stop apache2"
5 5
   if failed host localhost port 80 protocol http
6 6
     with timeout 10 seconds
7 7
     then restart

+ 2
- 2
roles/monitoring/files/etc_monit_conf.d_dovecot View File

@@ -1,7 +1,7 @@
1 1
 check process dovecot with pidfile /var/run/dovecot/master.pid
2 2
   group mail
3
-  start program = "systemctl start dovecot"
4
-  stop program = "systemctl stop dovecot"
3
+  start program = "/bin/systemctl start dovecot"
4
+  stop program = "/bin/systemctl stop dovecot"
5 5
   if failed port 993 type tcpssl sslauto protocol imap for 5 cycles then restart
6 6
   if failed port 995 type tcpssl sslauto protocol pop for 5 cycles then restart
7 7
   if 3 restarts within 5 cycles then timeout

+ 8
- 0
roles/monitoring/files/etc_monit_conf.d_fathom View File

@@ -0,0 +1,8 @@
1
+check process fathom matching fathom
2
+  group www
3
+  start program = "/bin/systemctl start fathom"
4
+  stop program = "/bin/systemctl stop fathom"
5
+  if failed port 9000 protocol http
6
+    with timeout 10 seconds
7
+    then restart
8
+  if 5 restarts within 5 cycles then timeout

+ 2
- 2
roles/monitoring/files/etc_monit_conf.d_pgsql View File

@@ -1,6 +1,6 @@
1 1
 check process postgres with pidfile /var/run/postgresql/9.6-main.pid
2 2
   group database
3
-  start program = "systemctl start postgresql"
4
-  stop program = "systemctl stop postgresql"
3
+  start program = "/bin/systemctl start postgresql"
4
+  stop program = "/bin/systemctl stop postgresql"
5 5
   if failed host localhost port 5432 protocol pgsql then restart
6 6
   if 5 restarts within 5 cycles then timeout

+ 2
- 2
roles/monitoring/files/etc_monit_conf.d_postfix View File

@@ -1,6 +1,6 @@
1 1
 check process postfix with pidfile /var/spool/postfix/pid/master.pid
2 2
   group mail
3
-  start program = "systemctl start postfix"
4
-  stop  program = "systemctl stop postfix"
3
+  start program = "/bin/systemctl start postfix"
4
+  stop program = "/bin/systemctl stop postfix"
5 5
   if failed port 25 protocol smtp then restart
6 6
   if 5 restarts within 5 cycles then timeout

+ 8
- 0
roles/monitoring/files/etc_monit_conf.d_prosody View File

@@ -0,0 +1,8 @@
1
+check process prosody with pidfile /var/run/prosody/prosody.pid
2
+  group social
3
+  start program = "/bin/systemctl start prosody"
4
+  stop program = "/bin/systemctl stop prosody"
5
+  if failed port 5222 type tcp
6
+    with timeout 10 seconds
7
+    then restart
8
+  if 5 restarts within 5 cycles then timeout

+ 8
- 0
roles/monitoring/files/etc_monit_conf.d_redis View File

@@ -0,0 +1,8 @@
1
+check process redis with pidfile /var/run/redis/redis-server.pid
2
+  group mail
3
+  start program = "/bin/systemctl start redis"
4
+  stop program = "/bin/systemctl stop redis"
5
+  if failed port 6379 type tcp
6
+    with timeout 10 seconds
7
+    then restart
8
+  if 5 restarts within 5 cycles then timeout

+ 8
- 0
roles/monitoring/files/etc_monit_conf.d_rspamd View File

@@ -0,0 +1,8 @@
1
+check process rspamd matching rspamd
2
+  group mail
3
+  start program = "/bin/systemctl start rspamd"
4
+  stop program = "/bin/systemctl stop rspamd"
5
+  if failed port 11333 type tcp
6
+    with timeout 10 seconds
7
+    then restart
8
+  if 5 restarts within 5 cycles then timeout

+ 3
- 2
roles/monitoring/files/etc_monit_conf.d_sshd View File

@@ -1,5 +1,6 @@
1 1
 check process sshd with pidfile /var/run/sshd.pid
2
-  start program "systemctl start ssh"
3
-  stop program  "systemctl stop ssh"
2
+  group system
3
+  start program = "/bin/systemctl start ssh"
4
+  stop program = "/bin/systemctl stop ssh"
4 5
   if failed host 127.0.0.1 port 22 protocol ssh then restart
5 6
   if 5 restarts within 5 cycles then timeout

+ 2
- 2
roles/monitoring/files/etc_monit_conf.d_tomcat View File

@@ -1,6 +1,6 @@
1 1
 check process tomcat with pidfile "/var/run/tomcat8.pid"
2 2
   group mail
3
-  start program = "systemctl start tomcat8"
4
-  stop program = "systemctl stop tomcat8"
3
+  start program = "/bin/systemctl start tomcat8"
4
+  stop program = "/bin/systemctl stop tomcat8"
5 5
   if failed port 8080 then alert
6 6
   if failed port 8080 for 5 cycles then restart

+ 4
- 4
roles/monitoring/files/etc_monit_conf.d_znc View File

@@ -1,8 +1,8 @@
1 1
 check process znc with pidfile /var/run/znc/znc.pid
2
-  group irc
3
-  start program = "systemctl start znc"
4
-  stop program = "systemctl stop znc"
5
-  if failed host localhost port 6643 protocol http
2
+  group social
3
+  start program = "/bin/systemctl start znc"
4
+  stop program = "/bin/systemctl stop znc"
5
+  if failed port 6643 type tcp
6 6
     with timeout 10 seconds
7 7
     then restart
8 8
   if 5 restarts within 5 cycles then timeout

+ 36
- 0
roles/monitoring/tasks/monit.yml View File

@@ -20,11 +20,47 @@
20 20
   stat: path=/usr/lib/znc/configs/znc.conf
21 21
   register: znc_config_file
22 22
 
23
+- name: Determine if XMPP is installed
24
+  stat: path=/etc/prosody/prosody.cfg.lua
25
+  register: prosody_config_file
26
+
27
+- name: Determine if Fathom is installed
28
+  stat: path=/usr/local/bin/fathom
29
+  register: fathom_config_file
30
+
31
+- name: Determine if Redis is installed
32
+  stat: path=/etc/redis/redis.conf
33
+  register: redis_config_file
34
+
35
+- name: Determine if RSpamD is installed
36
+  stat: path=/etc/rspamd/rspamd.conf
37
+  register: rspamd_config_file
38
+
23 39
 - name: Copy ZNC monit service config files into place
24 40
   copy: src=etc_monit_conf.d_znc dest=/etc/monit/conf.d/znc
25 41
   notify: restart monit
26 42
   when: znc_config_file.stat.exists == True
27 43
 
44
+- name: Copy XMPP monit service config files into place
45
+  copy: src=etc_monit_conf.d_prosody dest=/etc/monit/conf.d/prosody
46
+  notify: restart monit
47
+  when: prosody_config_file.stat.exists == True
48
+
49
+- name: Copy Fathom monit service config files into place
50
+  copy: src=etc_monit_conf.d_fathom dest=/etc/monit/conf.d/fathom
51
+  notify: restart monit
52
+  when: fathom_config_file.stat.exists == True
53
+
54
+- name: Copy Redis monit service config files into place
55
+  copy: src=etc_monit_conf.d_redis dest=/etc/monit/conf.d/redis
56
+  notify: restart monit
57
+  when: redis_config_file.stat.exists == True
58
+
59
+- name: Copy RSpamD monit service config files into place
60
+  copy: src=etc_monit_conf.d_rspamd dest=/etc/monit/conf.d/rspamd
61
+  notify: restart monit
62
+  when: rspamd_config_file.stat.exists == True
63
+
28 64
 - name: Copy monit service config files into place
29 65
   copy: src=etc_monit_conf.d_{{ item }} dest=/etc/monit/conf.d/{{ item }}
30 66
   with_items:

Loading…
Cancel
Save