I'll paste in my config file tomorrow (if I remember!).
set daemon 300 with start delay 120
set logfile syslog facility log_daemon
set mailserver localhost
set mail-format { from:
[email protected] }
set alert
[email protected]
set eventqueue basedir /var/monit slots 500
#set httpd port 2812 and
# SSL ENABLE
# PEMFILE /var/certs/monit.pem
# allow admin
assword
# System
check system yourserver.com
group system
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if swap usage > 25% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
# MySQL
check process mysql with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
# if failed host 127.0.0.1 port 3306 then restart
# if 5 restarts within 5 cycles then timeout
if failed host 127.0.0.1 port 3306 then alert
if 5 restarts within 5 cycles then alert
#depends mysqld_init
# depends mysqld_bin
# depends mysqldsafe_bin
#check file mysqld_init with path /etc/init.d/mysql
# group database
#check file mysqld_bin with path /usr/sbin/mysqld
# group database
#check file mysqldsafe_bin with path /usr/bin/mysqld_safe
# group database
# Apache
check process apache with pidfile /var/run/httpd.pid
group www
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host
www.yourdomain.co.uk port 80 protocol http then restart
# and request "/monit/token" then alert
if cpu > 80% for 5 cycles then restart
if totalmem > 500 MB for 5 cycles then restart
if children > 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout
# Postfix
check process postfix with pidfile /var/spool/postfix/pid/master.pid
group mail
start program = "/etc/init.d/postfix start"
stop program = "/etc/init.d/postfix stop"
if failed port 25 protocol smtp then restart
if 5 restarts within 5 cycles then timeout
# Cron
check process cron with pidfile /var/run/crond.pid
start program = "/etc/init.d/crond start"
stop program = "/etc/init.d/crond stop"
group system
depends cron_init, cron_bin
check file cron_init with path /etc/init.d/crond
group system
check file cron_bin with path /usr/sbin/crond
group system
# SSHd
check process sshd with pidfile /var/run/sshd.pid
group ssh
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
# Syslogd
#check process syslogd with pidfile /var/run/syslogd.pid
# start program = "/etc/init.d/sysklogd start"
# stop program = "/etc/init.d/sysklogd stop"
# if 5 restarts within 5 cycles then timeout
#check file syslogd_file with path /var/log/syslog
# Courier_imapd
check process imapd with pidfile /var/run/courier/imapd.pid
group mail
start program = "/etc/init.d/courier-imap start"
stop program = "/etc/init.d/courier-imap stop"
if failed port 143 then restart
if 5 restarts within 5 cycles then timeout
# Courier_immapd-ssl
#check process imapd-ssl with pidfile /var/run/courier/imapd-ssl.pid
# group mail
# start program = "/etc/init.d/courier-imap-ssl start"
# stop program = "/etc/init.d/courier-imap-ssl stop"
# if failed port 143 then alert
# if 5 restarts within 5 cycles then timeout
# Munin-node
#check process munin-node with pidfile /var/run/munin/munin-node.pid
# group services
# start program = "/etc/init.d/munin-node start"
# stop program = "/etc/init.d/munin-node stop"
# if 5 restarts within 5 cycles then timeout
#check process sw-cp-serverd with pidfile /var/run/sw-cp-server.pid
# group plesk
# start program = "/etc/init.d/sw-cp-server start"
# stop program = "/etc/init.d/sw-cp-server stop"
# if 2 restarts within 3 cycles then timeout
# if failed port 11443 protocol http then alert
# if failed port 11444 protocol http then alert
-------
Tried to add sw-cp-serverd but can't figure out how yet! Also the imapd-ssl doesn't exist.