1 ###############################################################################
3 ###############################################################################
5 ## Comments begin with a '#' and extend through the end of the line. Keywords
6 ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
8 ## Below you will find examples of some frequently used statements. For
9 ## information about the control file, a complete list of statements and
10 ## options please have a look in the monit manual.
13 ###############################################################################
15 ###############################################################################
17 ## Start monit in the background (run as a daemon) and check services at
18 ## 2-minute intervals.
23 ## Set syslog logging with the 'daemon' facility. If the FACILITY option is
24 ## omitted, monit will use 'user' facility by default. If you want to log to
25 ## a stand alone log file instead, specify the path to a log file
27 # set logfile syslog facility log_daemon
30 ## Set the list of mail servers for alert delivery. Multiple servers may be
31 ## specified using comma separator. By default monit uses port 25 - this
32 ## is possible to override with the PORT option.
34 # set mailserver mail.bar.baz, # primary mailserver
35 # backup.bar.baz port 10025, # backup mailserver on port 10025
36 # localhost # fallback relay
39 ## By default monit will drop alert events if no mail servers are available.
40 ## If you want to keep the alerts for a later delivery retry, you can use the
41 ## EVENTQUEUE statement. The base directory where undelivered alerts will be
42 ## stored is specified by the BASEDIR option. You can limit the maximal queue
43 ## size using the SLOTS option (if omitted, the queue is limited by space
44 ## available in the back end filesystem).
47 # basedir /var/monit # set the base directory where events will be stored
48 # slots 100 # optionaly limit the queue size
51 ## Monit by default uses the following alert mail format:
54 ## From: monit@$HOST # sender
55 ## Subject: monit alert -- $EVENT $SERVICE # subject
57 ## $EVENT Service $SERVICE #
62 ## Description: $DESCRIPTION #
64 ## Your faithful employee, #
68 ## You can override this message format or parts of it, such as subject
69 ## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc.
70 ## are expanded at runtime. For example, to override the sender:
72 # set mail-format { from: monit@foo.bar }
75 ## You can set alert recipients here whom will receive alerts if/when a
76 ## service defined in this file has errors. Alerts may be restricted on
77 ## events by using a filter as in the second example below.
79 # set alert sysadm@foo.bar # receive all alerts
80 # set alert manager@foo.bar only on { timeout } # receive just service-
84 ## Monit has an embedded web server which can be used to view status of
85 ## services monitored, the current configuration, actual services parameters
86 ## and manage services from a web interface.
88 # set httpd port 2812 and
89 # use address localhost # only accept connection from localhost
90 # allow localhost # allow localhost to connect to the server and
91 # allow admin:monit # require user 'admin' with password 'monit'
94 ###############################################################################
96 ###############################################################################
98 ## Check general system resources such as load average, cpu and memory
99 ## usage. Each test specifies a resource, conditions and the action to be
100 ## performed should a test fail.
102 # check system myhost.mydomain.tld
103 # if loadavg (1min) > 4 then alert
104 # if loadavg (5min) > 2 then alert
105 # if memory usage > 75% then alert
106 # if cpu usage (user) > 70% then alert
107 # if cpu usage (system) > 30% then alert
108 # if cpu usage (wait) > 20% then alert
111 ## Check a file for existence, checksum, permissions, uid and gid. In addition
112 ## to alert recipients in the global section, customized alert will be sent to
113 ## additional recipients by specifying a local alert handler. The service may
114 ## be grouped using the GROUP option.
116 # check file apache_bin with path /usr/local/apache/bin/httpd
117 # if failed checksum and
118 # expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
119 # if failed permission 755 then unmonitor
120 # if failed uid root then unmonitor
121 # if failed gid root then unmonitor
122 # alert security@foo.bar on {
123 # checksum, permission, uid, gid, unmonitor
124 # } with the mail-format { subject: Alarm! }
128 ## Check that a process is running, in this case Apache, and that it respond
129 ## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory,
130 ## and number of children. If the process is not running, monit will restart
131 ## it by default. In case the service was restarted very often and the
132 ## problem remains, it is possible to disable monitoring using the TIMEOUT
133 ## statement. This service depends on another service (apache_bin) which
136 # check process apache with pidfile /usr/local/apache/logs/httpd.pid
137 # start program = "/etc/init.d/httpd start"
138 # stop program = "/etc/init.d/httpd stop"
139 # if cpu > 60% for 2 cycles then alert
140 # if cpu > 80% for 5 cycles then restart
141 # if totalmem > 200.0 MB for 5 cycles then restart
142 # if children > 250 then restart
143 # if loadavg(5min) greater than 10 for 8 cycles then stop
144 # if failed host www.tildeslash.com port 80 protocol http
145 # and request "/monit/doc/next.php"
147 # if failed port 443 type tcpssl protocol http
148 # with timeout 15 seconds
150 # if 3 restarts within 5 cycles then timeout
151 # depends on apache_bin
155 ## Check device permissions, uid, gid, space and inode usage. Other services,
156 ## such as databases, may depend on this resource and an automatically graceful
157 ## stop may be cascaded to them before the filesystem will become full and data
160 # check device datafs with path /dev/sdb1
161 # start program = "/bin/mount /data"
162 # stop program = "/bin/umount /data"
163 # if failed permission 660 then unmonitor
164 # if failed uid root then unmonitor
165 # if failed gid disk then unmonitor
166 # if space usage > 80% for 5 times within 15 cycles then alert
167 # if space usage > 99% then stop
168 # if inode usage > 30000 then alert
169 # if inode usage > 99% then stop
173 ## Check a file's timestamp. In this example, we test if a file is older
174 ## than 15 minutes and assume something is wrong if its not updated. Also,
175 ## if the file size exceed a given limit, execute a script
177 # check file database with path /data/mydatabase.db
178 # if failed permission 700 then alert
179 # if failed uid data then alert
180 # if failed gid data then alert
181 # if timestamp > 15 minutes then alert
182 # if size > 100 MB then exec "/my/cleanup/script"
185 ## Check directory permission, uid and gid. An event is triggered if the
186 ## directory does not belong to the user with uid 0 and gid 0. In addition,
187 ## the permissions have to match the octal description of 755 (see chmod(1)).
189 # check directory bin with path /bin
190 # if failed permission 755 then unmonitor
191 # if failed uid 0 then unmonitor
192 # if failed gid 0 then unmonitor
195 ## Check a remote host network services availability using a ping test and
196 ## check response content from a web server. Up to three pings are sent and
197 ## connection to a port and a application level network check is performed.
199 # check host myserver with address 192.168.1.1
200 # if failed icmp type echo count 3 with timeout 3 seconds then alert
201 # if failed port 3306 protocol mysql with timeout 15 seconds then alert
203 # http://user:password@www.foo.bar:8080/?querystring
204 # and content == 'action="j_security_check"'
208 ###############################################################################
210 ###############################################################################
212 ## It is possible to include additional configuration parts from other files or
215 # include /etc/monit.d/*