-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonitrc
64 lines (52 loc) · 2.15 KB
/
monitrc
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
set daemon 120 # check services at 2-minute intervals
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set mailserver localhost
set eventqueue
basedir /var/lib/monit/events # set the base directory where events will be stored
slots 100 # optionally limit the queue size
set alert [email protected] # receive all alerts
check system localhost
if memory usage > 85% then alert
if cpu usage (user) > 80% for 3 cycles then alert
if cpu usage (system) > 80% for 3 cycles then alert
check filesystem rootfs with path /
if space usage > 80% then alert
# OVH1
#check filesystem home with path /home
#if space usage > 80% then alert
# Mon replication
#check file DbSlaveReplication with path /var/run/monit/watchdog
# IF timestamp > 10 minutes then alert
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
group www-data
check process mysql with pidfile /var/run/mysqld/mysqld.pid
group mysql
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
if cpu > 60% for 2 cycles then alert
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout
check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/ssh start"
stop program "/etc/init.d/ssh stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
check process redis
with pidfile /var/run/redis/redis-6379.pid
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout
#check process redis-6380
# with pidfile /var/run/redis/redis-6380.pid
# start program = "/etc/init.d/redis-6380 start"
# stop program = "/etc/init.d/redis-6380 stop"
# if failed host 127.0.0.1 port 6380 then restart
# if 5 restarts within 5 cycles then timeout
#check file DbSlaveReplication with path /var/run/monit/watchdog
# IF timestamp > 2 minutes then alert
include /etc/monit/conf.d/*