-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprincemonit.conf
93 lines (74 loc) · 3.41 KB
/
princemonit.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
set alert [email protected]
set httpd port 2812 and
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
allow admin:YourPasswordHere # require user 'admin' with password 'moni$
allow @monit # allow users of group 'monit' to connect (rw)
allow @users readonly # allow users of group 'users' to connect readonly
#Make sure that mysql server is running.
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group mysql
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
#if mysql server failed to respond within 15 seconds, 3 times in 4 cycles, restart the server
if failed host localhost port 3306 protocol mysql with timeout 15 seconds for 3 times within 4 cycles then restart
if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 3 times within 4 cycles then restart
if 5 restarts with 5 cycles then timeout
depend mysql_bin
#depend mysql_rccheck file mysql_bin with path /usr/sbin/mysqld
check file mysql_bin with path /usr/sbin/mysqld
group mysql
include /etc/monit/templates/rootbincheck
check file mysql_rc with path /etc/init.d/mysql
group mysql
include /etc/monit/templates/rootbin
#monitor apache web server
check process apache with pidfile /var/run/apache2/apache2.pid
group www-data
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"
if 4 restarts within 20 cycles then timeout
if failed host localhost port 80 with protocol http and request "/server-status" with timeout 25 seconds for 4 times within 5 cycles then restart
depend apache_bin
depend apache_rc
check file apache_bin with path /usr/sbin/apache2
group www-data
include /etc/monit/templates/rootbin
check file apache_rc with path /etc/init.d/apache2
group www-data
include /etc/monit/templates/rootbin
#Monitors a web domain, alert it's online status and loading information.
# if load average is greater than 2 within 5 minutes, send an alert to admin about the load information.
# if load average is greater than 4 within 5 minutes, send an alert to admin about the load information.
check system lasvegasconvention.center
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
# if Memory usage is greater than 75% send an alert
if memory usage > 75% then alert
# if Swap usage is greater than 25% send an alert
if swap usage > 25% then alert
# if CPU User usage is greater than 70% send an alert
if cpu usage (user) > 70% then alert
# if CPU System usage is greater than 75% send an alert
if cpu usage (system) > 30% then alert
# if CPU wait is greater than 20% send an alert
if cpu usage (wait) > 20% then alert
check system vegasnewspaper.com
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if swap usage > 25% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
set mail-format {
from: monit@$HOST
subject: monit alert -- $EVENT $SERVICE
message: $EVENT Service $SERVICE
Date: $DATE
Action: $ACTION
Host: $HOST
Description: $DESCRIPTION
Your faithful employee,
Monit
}