############################################################################### ## Monit control file ############################################################################### ## ## Comments begin with a '#' and extend through the end of the line. Keywords ## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'. ## ## Bellow is the example of some frequently used statements. For information ## about the control file, a complete list of statements and options please ## have a look in the monit manual. ## ## ############################################################################### ## Global section ############################################################################### ## ## Start monit in background (run as daemon) and check the services at 2-minute ## intervals. # set daemon 60 # # ## Set syslog logging with the 'daemon' facility. If the FACILITY option is ## omited, monit will use 'user' facility by default. You can specify the ## path to the file for monit native logging. # set logfile /var/log/monit # # ## Set list of mailservers for alert delivery. Multiple servers may be ## specified using comma separator. By default monit uses port 25 - it is ## possible to override it with the PORT option. # # set mailserver mail.bar.baz, # primary mailserver # backup.bar.baz port 10025, # backup mailserver on port 10025 # localhost # fallback relay # # ## By default monit will drop the event alert, in the case that there is no ## mailserver available. In the case that you want to keep the events for ## later delivery retry, you can use the EVENTQUEUE statement. The base ## directory where undelivered events will be stored is specified by the ## BASEDIR option. You can limit the maximal queue size using the SLOTS ## option (if omited then the queue is limited just by the backend filesystem). # # set eventqueue # basedir /var/monit # set the base directory where events will be stored # slots 100 # optionaly limit the queue size # # ## Monit by default uses the following alert mail format: ## ## --8<-- ## From: monit@$HOST # sender ## Subject: monit alert -- $EVENT $SERVICE # subject ## ## $EVENT Service $SERVICE # ## # ## Date: $DATE # ## Action: $ACTION # ## Host: $HOST # body ## Description: $DESCRIPTION # ## # ## Your faithful employee, # ## monit # ## --8<-- ## ## You can override the alert message format or its parts such as subject ## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc. ## are expanded on runtime. For example to override the sender: # # set mail-format { from: monit@foo.bar } # # ## You can set the alert recipients here, which will receive the alert for ## each service. The event alerts may be restricted using the list. # # set alert sysadm@foo.bar # receive all alerts # set alert manager@foo.bar only on { timeout } # receive just service- # # timeout alert # # ## Monit has an embedded webserver, which can be used to view the ## configuration, actual services parameters or manage the services using the ## web interface. # set httpd port 2812 and allow admin:monit # use address localhost # only accept connection from localhost # allow localhost # allow localhost to connect to the server and # allow admin:monit # require user 'admin' with password 'monit' # # ############################################################################### ## Services ############################################################################### ## check system test.test.net # if loadavg (1min) > 4 then alert # if loadavg (5min) > 2 then alert # if memory usage > 75% then alert # if cpu usage (user) > 70% then alert # if cpu usage (system) > 30% then alert # if cpu usage (wait) > 20% then alert # check process cron with pidfile /var/run/crond.pid start program = "/etc/init.d/cron start" stop program = "/etc/init.d/cron stop" 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 5 restarts within 5 cycles then timeout # ############################################################################### ## Includes ############################################################################### ## ## It is possible to include the configuration or its parts from other files or ## directories. # # include /etc/monit.d/* # #