6 |
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'. |
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'. |
7 |
## |
## |
8 |
## Bellow is the example of some frequently used statements. For information |
## Bellow is the example of some frequently used statements. For information |
9 |
## about the control file, complete list of statements and options please see |
## about the control file, a complete list of statements and options please |
10 |
## the monit manual. |
## have a look in the monit manual. |
11 |
## |
## |
12 |
## |
## |
13 |
############################################################################### |
############################################################################### |
20 |
# set daemon 120 |
# set daemon 120 |
21 |
# |
# |
22 |
# |
# |
23 |
## Set syslog logging with the 'daemon' facility. If the facility option is |
## Set syslog logging with the 'daemon' facility. If the FACILITY option is |
24 |
## omited, monit will use 'user' facility by default. You can specify the |
## omited, monit will use 'user' facility by default. You can specify the |
25 |
## path to the file for monit native logging. |
## path to the file for monit native logging. |
26 |
# |
# |
27 |
# set logfile syslog facility log_daemon |
# set logfile syslog facility log_daemon |
28 |
# |
# |
29 |
# |
# |
30 |
## Set list of mailservers for alert delivery. Multiple servers may be specified |
## Set list of mailservers for alert delivery. Multiple servers may be |
31 |
## using comma separator. By default monit uses port 25 - it is possible to |
## specified using comma separator. By default monit uses port 25 - it is |
32 |
## override it with the port option. |
## possible to override it with the PORT option. |
33 |
# |
# |
34 |
# set mailserver mail.bar.baz, # primary mailserver |
# set mailserver mail.bar.baz, # primary mailserver |
35 |
# backup.bar.baz port 10025, # backup mailserver on port 10025 |
# backup.bar.baz port 10025, # backup mailserver on port 10025 |
36 |
# localhost # fallback relay |
# localhost # fallback relay |
37 |
# |
# |
38 |
# |
# |
39 |
## By default will monit frop the event alert, in the case that there is no |
## By default monit will drop the event alert, in the case that there is no |
40 |
## mailserver available. In the case that you want to keep the events for |
## mailserver available. In the case that you want to keep the events for |
41 |
## later delivery retry, you can use the eventqueue statement. The base |
## later delivery retry, you can use the EVENTQUEUE statement. The base |
42 |
## directory where undelivered events will be stored is specified by the |
## directory where undelivered events will be stored is specified by the |
43 |
## basedir option. You can limit the maximal queue size using the slots |
## BASEDIR option. You can limit the maximal queue size using the SLOTS |
44 |
## option (if omited then the queue is limited just by the backend filesystem). |
## option (if omited then the queue is limited just by the backend filesystem). |
45 |
# |
# |
46 |
# set eventqueue |
# set eventqueue |
65 |
## --8<-- |
## --8<-- |
66 |
## |
## |
67 |
## You can override the alert message format or its parts such as subject |
## You can override the alert message format or its parts such as subject |
68 |
## or sender using the mail-format statement. Macros such as $DATE, etc. |
## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc. |
69 |
## are expanded on runtime. For example to override the sender: |
## are expanded on runtime. For example to override the sender: |
70 |
# |
# |
71 |
# set mail-format { from: monit@foo.bar } |
# set mail-format { from: monit@foo.bar } |
79 |
# # timeout alert |
# # timeout alert |
80 |
# |
# |
81 |
# |
# |
82 |
## Monit has embedded webserver, which can be used to view the configuration, |
## Monit has an embedded webserver, which can be used to view the |
83 |
## actual services parameters or manage the services using the web interface. |
## configuration, actual services parameters or manage the services using the |
84 |
|
## web interface. |
85 |
# |
# |
86 |
# set httpd port 2812 and |
# set httpd port 2812 and |
87 |
# use address localhost # only accept connection from localhost |
# use address localhost # only accept connection from localhost |
106 |
# if cpu usage (wait) > 20% then alert |
# if cpu usage (wait) > 20% then alert |
107 |
# |
# |
108 |
# |
# |
109 |
## Check the apache binary file for existence, checksum, permissions, uid and |
## Check a file for existence, checksum, permissions, uid and gid. In addition |
110 |
## gid. In addition to the recipients in the Global section, customized alert |
## to the recipients in the global section, customized alert will be send to |
111 |
## will be send to the additional recipient. The service may be grouped using |
## the additional recipient. The service may be grouped using the GROUP option. |
|
## the group option. |
|
112 |
# |
# |
113 |
# check file apache_bin with path /usr/local/apache/bin/httpd |
# check file apache_bin with path /usr/local/apache/bin/httpd |
114 |
# if failed checksum and |
# if failed checksum and |
122 |
# group server |
# group server |
123 |
# |
# |
124 |
# |
# |
125 |
## Check that the process apache is running, responding on the HTTP and HTTPS |
## Check that a process is running, responding on the HTTP and HTTPS request, |
126 |
## request, check its resource usage such as cpu and memory, number of |
## check its resource usage such as cpu and memory, number of childrens. |
127 |
## childrens. In the case that the process is not running, monit will restart |
## In the case that the process is not running, monit will restart it by |
128 |
## it by default. In the case that the service was restarted very often and |
## default. In the case that the service was restarted very often and the |
129 |
## the problem remains, it is possible to disable the monitoring using the |
## problem remains, it is possible to disable the monitoring using the |
130 |
## timeout statement. The service depends on another service (apache_bin) which |
## TIMEOUT statement. The service depends on another service (apache_bin) which |
131 |
## is defined in the monit control file as well. |
## is defined in the monit control file as well. |
132 |
# |
# |
133 |
# check process apache with pidfile /usr/local/apache/logs/httpd.pid |
# check process apache with pidfile /usr/local/apache/logs/httpd.pid |
167 |
# group server |
# group server |
168 |
# |
# |
169 |
# |
# |
170 |
## Check the database timestamp: when it becomes older then 15 minites, |
## Check a file's timestamp: when it becomes older then 15 minites, the |
171 |
## the database is not updated and something is wrong. In the case that |
## file is not updated and something is wrong. In the case that the size |
172 |
## the size of the database exceeded given limit, perform the script. |
## of the file exceeded given limit, perform the script. |
173 |
# |
# |
174 |
# check file database with path /data/mydatabase.db |
# check file database with path /data/mydatabase.db |
175 |
# if failed permission 700 then alert |
# if failed permission 700 then alert |
179 |
# if size > 100 MB then exec "/my/cleanup/script" |
# if size > 100 MB then exec "/my/cleanup/script" |
180 |
# |
# |
181 |
# |
# |
182 |
## Check the directory permission, uid and gid. |
## Check the directory permission, uid and gid. An event is triggered |
183 |
|
## if the directory does not belong to the user with the uid 0 and |
184 |
|
## the gid 0. In the addition the permissions have to match the octal |
185 |
|
## description of 755 (see chmod(1)). |
186 |
# |
# |
187 |
# check directory bin with path /bin |
# check directory bin with path /bin |
188 |
# if failed permission 755 then unmonitor |
# if failed permission 755 then unmonitor |
191 |
# |
# |
192 |
# |
# |
193 |
## Check the remote host network services availability and the response |
## Check the remote host network services availability and the response |
194 |
## content. |
## content. One of three pings, a successfull connection to a port and |
195 |
|
## application level network check is performed. |
196 |
# |
# |
197 |
# check host myserver with address 192.168.1.1 |
# check host myserver with address 192.168.1.1 |
198 |
# if failed icmp type echo count 3 with timeout 3 seconds then alert |
# if failed icmp type echo count 3 with timeout 3 seconds then alert |