-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmonit.rb
99 lines (96 loc) · 2.58 KB
/
monit.rb
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
93
94
95
96
97
98
99
default[:monit][:config_file] = '/etc/monit.conf'
default[:monit][:config_dir] = '/etc/monit.d'
default[:monit][:config][:alert] = []
default[:monit][:monitor] = {
'nginx' => node[:nginx][:enabled],
'httpd' => node[:httpd][:enabled] || node[:mod_php7][:enabled],
'hhvm' => node[:hhvm][:enabled],
'php-fpm' => node[:phpfpm][:enabled],
'mysql' => node[:mysql][:enabled],
'memcached' => node[:memcached][:enabled],
'crond' => true,
'logging' => true,
}
default[:monit][:source] = {
'nginx' => 'monit/nginx.erb',
'httpd' => 'monit/process_monitor.erb',
'hhvm' => 'monit/process_monitor.erb',
'php-fpm' => 'monit/php-fpm.erb',
'mysql' => 'monit/process_monitor.erb',
'memcached' => 'monit/process_monitor.erb',
'crond' => 'monit/process_monitor.erb',
'logging' => 'monit/logging.erb'
}
default[:monit][:settings][:processes] = [
{
:name => 'nginx',
:pidfile => '/var/run/nginx.pid',
:start => '/sbin/service nginx start',
:stop => '/sbin/service nginx stop',
:user => node[:nginx][:config][:user],
:group => node[:nginx][:config][:group],
:rules => [
]
},
{
:name => 'httpd',
:pidfile => '/var/run/httpd/httpd.pid',
:start => '/sbin/service httpd start',
:stop => '/sbin/service httpd stop',
:user => node[:nginx][:config][:user],
:group => node[:nginx][:config][:group],
:rules => [
]
},
{
:name => 'hhvm',
:pidfile => '/var/tmp/hhvm.pid ',
:start => '/sbin/service hhvm start',
:stop => '/sbin/service hhvm stop',
:user => node[:php][:config][:user],
:group => node[:php][:config][:group],
:rules => [
]
},
{
:name => 'php-fpm',
:pidfile => '/var/run/php-fpm/php-fpm.pid',
:start => '/sbin/service php-fpm start',
:stop => '/sbin/service php-fpm stop',
:user => node[:php][:config][:user],
:group => node[:php][:config][:group],
:rules => [
]
},
{
:name => 'mysql',
:pidfile => '/var/run/mysqld/mysqld.pid',
:start => '/sbin/service mysql start',
:stop => '/sbin/service mysql stop',
:user => node[:mysql][:config][:user],
:group => node[:mysql][:config][:group],
:rules => [
]
},
{
:name => 'memcached',
:pidfile => '/var/run/memcached/memcached.pid',
:start => '/sbin/service memcached start',
:stop => '/sbin/service memcached stop',
:rules => [
]
},
{
:name => 'crond',
:pidfile => '/var/run/crond.pid',
:start => '/sbin/service crond start',
:stop => '/sbin/service crond stop',
:rules => [
]
},
{
:name => 'logging',
:rules => [
]
},
]