15 |
# file for an example). |
# file for an example). |
16 |
# |
# |
17 |
# path -- Must be followed by a path to the block special file |
# path -- Must be followed by a path to the block special file |
18 |
# for filesystem (device), regular file, directory or |
# for filesystem (device), regular file or directory. |
|
# process's pidfile. |
|
19 |
# |
# |
20 |
# group -- Must be followed by a descriptive name for a monitored |
# group -- Must be followed by a descriptive name for a monitored |
21 |
# services group. This statement can be used to group |
# services group. This statement can be used to group |
26 |
# starting the service. If you need to specify arguments |
# starting the service. If you need to specify arguments |
27 |
# to the program, enclose the program and arguments in |
# to the program, enclose the program and arguments in |
28 |
# quotes - like: "/local/bin/program -i start". |
# quotes - like: "/local/bin/program -i start". |
|
# This entry is optional. |
|
29 |
# |
# |
30 |
# stop -- Must be followed by a full path to a program for |
# stop -- Must be followed by a full path to a program for |
31 |
# stopping the service. If you need to specify arguments |
# stopping the service. If you need to specify arguments |
32 |
# to the program, enclose the program and arguments in |
# to the program, enclose the program and arguments in |
33 |
# quotes - like: "/local/bin/program -i stop". |
# quotes - like: "/local/bin/program -i stop". |
|
# This entry is optional. |
|
34 |
# |
# |
35 |
# uid -- Must be followed by a user (name or uid number). This |
# uid -- Must be followed by a user (name or uid number). This |
36 |
# statement is either optionally part of the start/stop |
# statement is an optionally part of the start/stop |
37 |
# statement described above (then it makes monit start |
# statement described above (if so, it makes monit start |
38 |
# the program as the user given in the uid) or standalone |
# the program as the user given in the uid). uid can also |
39 |
# statement of file service check. |
# be used as a standalone statement in a file service |
40 |
|
# check entry to check for changes in uid. |
41 |
# |
# |
42 |
# gid -- Must be followed by a group (name or gid number). This |
# gid -- Must be followed by a group (name or gid number). This |
43 |
# statement is either optionally part of the start/stop |
# statement is an optionally part of the start/stop |
44 |
# statement described above (then it makes monit start |
# statement described above (if so, it makes monit start |
45 |
# the program as the group given in the gid) or standalone |
# the program as the group given in the gid). gid can also |
46 |
# statement of file service check. |
# be used as a standalone statement in a file service |
47 |
|
# check entry to check for changes in gid. |
48 |
# |
# |
49 |
# host -- Specify a hostname or ip-address to test port |
# host -- Specify a hostname or an ip-address to test port |
50 |
# connection at. This statement must be followed by a |
# connection at. This statement must be followed by a |
51 |
# port statement. |
# port statement. |
52 |
# |
# |
53 |
# port(number) -- Must be followed by an integer representing a portnumber. |
# port(number) -- Must be followed by an integer representing a portnumber. |
54 |
# The monit program will try to connect to this port to |
# The monit program will try to connect to this port to |
55 |
# to verify that there is a server listening behind the |
# to verify that there is a server listening behind the |
56 |
# portnumber. If the connection fails the default action |
# portnumber. |
|
# is to write a notification into the logfile and to |
|
|
# restart the process. This entry is optional. |
|
57 |
# |
# |
58 |
# unix(socket) -- Must be followed by a string representing a pathname. |
# unix(socket) -- Must be followed by a string representing a pathname. |
59 |
# The monit program will try to connect to this socket to |
# The monit program will try to connect to this socket to |
60 |
# to verify that there is a server listening behind the |
# to verify that there is a server listening behind the |
61 |
# unix socket. If the connection fails the default action |
# unix socket. |
|
# is to write a notification into the logfile and to |
|
|
# restart the process. This entry is optional. |
|
62 |
# |
# |
63 |
# type -- Must be followed by the keyword udp or tcp. This keyword |
# type -- Must be followed by the keyword udp or tcp. This keyword |
64 |
# specifies the type of socket the monit program should |
# specifies the type of socket the monit program should |
65 |
# use when testing connection to the portnumber. If the |
# use when testing the connection to the portnumber. If the |
66 |
# type keyword is omitted, tcp is used. |
# type keyword is omitted, tcp is used. |
67 |
# |
# |
68 |
# tcp -- Specifies that monit should use a TCP socket type |
# tcp -- Specifies that monit should use a TCP socket type |
69 |
# (Stream socket) when testing the port |
# (stream socket) when testing the port |
70 |
# |
# |
71 |
# tcpssl -- Specifies that monit should use a TCP |
# tcpssl -- Specifies that monit should use a TCP socket type |
72 |
# socket type (Stream socket) which is embeds a ssl |
# (stream socket) with ssl when testing the port. |
|
# connection when testing the port. |
|
73 |
# |
# |
74 |
# certmd5 -- The md5 sum of a certificate a ssl forged |
# certmd5 -- The md5 sum of a certificate a ssl forged |
75 |
# server has to deliver. |
# server has to deliver. |
79 |
# |
# |
80 |
# protocol -- Must be followed by a protocol keyword. This keyword |
# protocol -- Must be followed by a protocol keyword. This keyword |
81 |
# specifies the type of service found at the port. |
# specifies the type of service found at the port. |
82 |
# monit knows at the moment how to speak HTTP, SMTP, |
# monit knows how to speak many standard protocols, e.g. |
83 |
# FTP, POP, SSH, IMAP, NNTP, SSH, DWP, LDAP2 and LDAP3. |
# HTTP, SMTP, and FTP. See the monit man file for the |
84 |
# You're welcome to write new protocol test modules. If |
# complete protocol list. If no protocol is specified |
85 |
# no protocol is specified monit will use a default test |
# monit will use a default test which in most cases is |
86 |
# which in most cases is good enough. This statement is |
# good enough to test if a server is up or down. |
87 |
# optional. |
# |
88 |
# |
# request -- Must be followed by a request string specifying a document |
89 |
# request -- Must be followed by an URI string specifying a document |
# or entity to fetch from the server. Currently only the |
90 |
# from the http server. Currently only the HTTP protocol |
# HTTP protocol module supports the request statement, |
91 |
# module supports the request statement, such as: |
# such as: "/data/show.php?a=b&c=d" |
|
# "/data/show.php?a=b&c=d" |
|
92 |
# |
# |
93 |
# timeout -- Must be followed by two integers where the first |
# timeout -- Part of the timeout statement or used in a connection |
94 |
# number is max restart and the second the number of |
# statement for connect timeout. |
|
# poll-cycles. This statement is optional. |
|
|
# |
|
|
# alert -- Specifies an email address for notification if a |
|
|
# service produced timeout, start, restart, checksum, |
|
|
# resource, stop, connection, size, permission, uid, gid |
|
|
# or timestamp event. This statement is optional. More |
|
|
# than one alert statement is allowed. |
|
95 |
# |
# |
96 |
# checksum -- This statement is optional. More than one checksum |
# alert -- Specifies an email address for notification if an |
97 |
# statement is allowed. |
# error occured on a service. This statement is optional. |
98 |
|
# More than one alert statement is allowed. |
99 |
|
# |
100 |
|
# checksum -- Used in a file check entry to test the file for |
101 |
|
# checksum changes. See the monit man file for more |
102 |
|
# information. |
103 |
# |
# |
104 |
# expect -- Specify a md5 string digest monit should expect when |
# expect -- Specify a md5 string digest monit should expect when |
105 |
# testing a particular file's checksum. This statement is |
# testing a particular file's checksum. This statement is |
106 |
# an optional part of the checksum statement. |
# an optional part of the checksum statement. |
107 |
# |
# |
108 |
# timestamp -- Must be followed by compare operator, number, optional |
# timestamp -- Must be followed by compare operator, number, optional |
109 |
# time unit and action. This statement is optional. More |
# a time unit and an action. |
|
# than one timestamp statement is allowed. |
|
110 |
# |
# |
111 |
# size -- Must be followed by compare operator, number, optional |
# size -- Must be followed by compare operator, number, optional |
112 |
# size unit and action. This statement is optional. More |
# a size unit and an action. |
|
# than one size statement is allowed. |
|
113 |
# |
# |
114 |
# every -- Only check the service at every n cycles. Optional. |
# every -- Only check the service at every n cycles. |
115 |
# |
# |
116 |
# mode -- Must be followed either by the keyword active, passive |
# mode -- Must be followed either by the keyword active, passive |
117 |
# or manual. If active, monit will restart the service |
# or manual. If active, monit will restart the service |
126 |
# percent {%|percent}, optionally a maximum number of |
# percent {%|percent}, optionally a maximum number of |
127 |
# cycles and an action. This statement is used to check |
# cycles and an action. This statement is used to check |
128 |
# the cpu usage in percent of a process with it's children |
# the cpu usage in percent of a process with it's children |
129 |
# over a number of cycles. If the compare expression |
# over a number of cycles. If the compare expression |
130 |
# matches then the action (restart, alert or stop) is |
# matches then the action is executed. |
|
# executed. |
|
131 |
# |
# |
132 |
# mem -- The equivalent to cpu usage for memory of a process |
# mem -- The equivalent to cpu usage for memory of a process |
133 |
# (w/o children!). The syntax is equivilent to cpu, |
# (w/o children!). The syntax is equivilent to cpu, |
140 |
# equivilent to cpu, |
# equivilent to cpu, |
141 |
# |
# |
142 |
# totalmem -- The equivalent to mem for memory of a process |
# totalmem -- The equivalent to mem for memory of a process |
143 |
# (with children!). The syntax is the same |
# (with children!). The syntax is the same |
144 |
# |
# |
145 |
# loadavg -- Must be followed by [1min,5min,15min] in (), a |
# loadavg -- Must be followed by [1min,5min,15min] in (), a |
146 |
# compare operator, a number, optionally a |
# compare operator, a number, optionally a |
147 |
# maximum number of cycles and an action. This statement |
# maximum number of cycles and an action. This statement |
148 |
# is used to check the system load average over a number |
# is used to check the system load average over a number |
149 |
# of cycles. If the compare expression matches then the |
# of cycles. If the compare expression matches then the |
150 |
# action (restart, alert or stop) is executed. |
# action (restart, alert, exec or stop) is executed. |
151 |
# |
# |
152 |
# space -- Must be followed by a compare operator, number, |
# space -- Must be followed by a compare operator, number, |
153 |
# unit and action, where the unit is expressed in one of |
# unit and action, where the unit is expressed in one of |
154 |
# {B|KB|MB|GB|%|byte|kilobyte|megabyte|gigabyte|percent} |
# {B|KB|MB|GB|%|byte|kilobyte|megabyte|gigabyte|percent} |
155 |
# |
# |
156 |
# inode(s) -- Must be followed by a compare operator, integer number, |
# inode(s) -- Must be followed by a compare operator, integer number, |
157 |
# optionaly by percent sign (if not, the limit is absolute) |
# optionaly by a percent sign (if not, the limit is |
158 |
# and an action (required). |
# absolute) and an action (required). |
159 |
# |
# |
160 |
# perm(ission) -- Must be followed by an octal number describing |
# perm(ission) -- Must be followed by an octal number describing |
161 |
# the permissions. |
# the permissions monit should expect for a file, directory |
162 |
|
# or device. |
163 |
# |
# |
164 |
# depends -- Must be followed by the name of a service or a list of |
# depends -- Must be followed by the name of a service or a list of |
165 |
# services *this* service depends on to run |
# services *this* service depends on to run before it |
166 |
# before it starts. The list of depend services |
# starts. The list of depend services will be stopped |
167 |
# will be stopped before the current service is started |
# before the current service is started and started again |
168 |
# and started again after. |
# after. |
169 |
# |
# |
170 |
# Legal global option statements are |
# Legal global option statements are |
171 |
# |
# |
174 |
# set init -- If specified, do not background monit. This allows |
# set init -- If specified, do not background monit. This allows |
175 |
# init to control and restart monit. To work properly, |
# init to control and restart monit. To work properly, |
176 |
# modification of /etc/inittab is required. |
# modification of /etc/inittab is required. |
177 |
# (see FAQ.txt for details) |
# (see the FAQ.txt for details) |
178 |
# |
# |
179 |
# set logfile -- Must be followed by either a filename (full path is |
# set logfile -- Must be followed by either a filename (full path is |
180 |
# required) or the string 'syslog'. If 'syslog' is used, |
# required) or the string 'syslog'. If 'syslog' is used, |
183 |
# or 'log_daemon'. If no facility is set it will default |
# or 'log_daemon'. If no facility is set it will default |
184 |
# to LOG_USER |
# to LOG_USER |
185 |
# |
# |
186 |
# set pidfile -- Must be followed by either a filename (full path is |
# set pidfile -- Must be followed by a filename (full path is |
187 |
# required). |
# required) specifying the pid file for a monit daemon. |
188 |
|
# See the manual for default value if not specified. |
189 |
# |
# |
190 |
# set statefile -- Must be followed by a filename (full path is |
# set statefile -- Must be followed by a filename (full path is |
191 |
# required) spesifying where monit should store |
# required) specifying where monit should store |
192 |
# its state file. If not defined monit will use |
# its state file. If not defined monit will use |
193 |
# the file, $HOME/.monit.state |
# the file, $HOME/.monit.state |
194 |
# |
# |
223 |
# connecting to monit httpd |
# connecting to monit httpd |
224 |
# |
# |
225 |
# |
# |
226 |
# The noise keywords `if', `and', `the', `with', `has', `using', `use', |
# The noise keywords `is', `as', `are', `for', `and', `the', `with', |
227 |
# `on(ly)', `for', `than`, `then`, `usage` and `program(s)' are ignored anywhere |
# `has', `using', `use', `on(ly)', `with(in)', `was', `than`, `usage' |
228 |
# in an entry; they can be used to make it resemble English. The |
# and `program(s)' are ignored anywhere in an entry; they can be used |
229 |
# punctuation characters `,' `;' and '=' are also ignored. |
# to make it resemble English. The punctuation characters `,' `;' and |
230 |
|
# '=' are also ignored. |
231 |
# |
# |
232 |
# |
# |
233 |
# Here's an example for monitoring an apache web-server on port |
# Here's an example for monitoring an apache web-server on port |
234 |
# HTTP and HTTPS, Sybase Database Server and filesystems: |
# HTTP and HTTPS, Sybase Database Server and various filesystems: |
235 |
# |
# |
236 |
# [NB! Check and edit for your system and uncomment below] |
# [NB! Check and edit for your system and uncomment below] |
237 |
# |
# |
251 |
# stop program = "/etc/init.d/httpd stop" |
# stop program = "/etc/init.d/httpd stop" |
252 |
# if failed host www.tildeslash.com port 80 protocol http |
# if failed host www.tildeslash.com port 80 protocol http |
253 |
# and request "/monit/next.html" then restart |
# and request "/monit/next.html" then restart |
254 |
# if failed port 443 type tcpssl proto http then restart |
# if failed port 443 type tcpssl proto http with timeout 15 seconds |
255 |
# if cpu is greater than 60 % for 2 cycles then alert |
# then restart |
256 |
# if cpu > 80.0 % 5 restart |
# if cpu is greater than 60% for 2 cycles then alert |
257 |
|
# if cpu > 80% for 5 cycles restart |
258 |
# if mem > 100.0 MB for 5 cycles then stop |
# if mem > 100.0 MB for 5 cycles then stop |
259 |
# if loadavg(5min) greater than 10 for 8 cycles then stop |
# if loadavg(5min) greater than 10 for 8 cycles then stop |
|
# alert sysadm@foo.bar |
|
260 |
# if 3 restarts within 5 cycles then timeout |
# if 3 restarts within 5 cycles then timeout |
261 |
|
# alert sysadm@foo.bar |
262 |
# group server |
# group server |
263 |
# depends on apache_bin |
# depends on apache_bin |
|
# depends on sybase |
|
264 |
# |
# |
265 |
# |
# |
266 |
# check file apache_bin with path /usr/local/apache/bin/httpd |
# check file apache_bin with path /usr/local/apache/bin/httpd |
267 |
# if failed checksum and expect the sum 8f7f419955cefa0b33a2ba316cba3659 then stop |
# if failed checksum and |
268 |
|
# expect the sum 8f7f419955cefa0b33a2ba316cba3659 then stop |
269 |
# if failed permission 755 then stop |
# if failed permission 755 then stop |
270 |
# if failed uid root then stop |
# if failed uid root then stop |
271 |
# if failed gid root then stop |
# if failed gid root then stop |
272 |
# if size changed then stop |
# if size changed then stop |
273 |
# if timestamp changed then stop |
# if timestamp changed then stop |
274 |
# alert sysadm@foo.bar |
# alert sysadm@foo.bar |
275 |
# alert security@foo.bar on { checksum, permission, size, timestamp, uid, gid } |
# alert security@foo.bar on { |
276 |
# with the mail-format { subject: Alarm! } |
# checksum, permission, size, timestamp, uid, gid |
277 |
|
# } with the mail-format { subject: Alarm! } |
278 |
# group server |
# group server |
279 |
# |
# |
280 |
# |
# |
295 |
# if failed permission 660 then stop |
# if failed permission 660 then stop |
296 |
# if failed uid root then stop |
# if failed uid root then stop |
297 |
# if failed gid disk then stop |
# if failed gid disk then stop |
298 |
# if space usage > 80 % then alert |
# if space usage > 80% then alert |
299 |
# if space usage > 99 % then stop |
# if space usage > 99% then stop |
300 |
# if inode usage > 80 % then alert |
# if inode usage > 80% then alert |
301 |
# if inode usage > 99 % then stop |
# if inode usage > 99% then stop |
302 |
# alert root@localhost |
# alert root@localhost |
303 |
# group server |
# group server |
304 |
# |
# |