# * See http://mmonit.com/monit # # * Configure mail server # * Allow localhost connections # set hostname check system fqdn.hostname.com # set from address set mail-format { from: monit.server@domain.com } set alert alerts@domain.com set mailserver localhost set daemon 120 set logfile /var/log/monit.log set httpd port 2812 and allow localhost allow 192.168.12.0/24 allow 1.2.3.4 allow admin:monit # / filesystem - disable on virtual servers # check filesystem rootfs with path / if space usage > 75% then alert # /tmp directory - check permissions # check directory tmp with path "/tmp" if failed perm 1777 then exec "/bin/chmod 1777 /tmp" if failed uid root then exec "/bin/chown root /tmp" if failed gid root then exec "/bin/chown :root /tmp" # webmin # check process webmin with pidfile /var/webmin/miniserv.pid start program "/etc/webmin start" stop program "/etc/webmin stop" ## Ubuntu Linux ## # # Apache # check process apache with pidfile /var/run/apache2.pid start program = "/etc/init.d/apache2 start" stop program = "/etc/init.d/apache2 stop" # if cpu > 80% for 5 cycles then restart # if failed host localhost port 80 protocol http for 5 cycles then restart # # atd # check process atd with pidfile /var/run/atd.pid start program "/etc/init.d/atd start" stop program "/etc/init.d/atd stop" # # avahi # check process avahi with pidfile /var/run/avahi-daemon/pid start program "/etc/init.d/avahi-daemon start" stop program "/etc/init.d/avahi-daemon stop" # # collectd # check process collectd with pidfile /var/run/collectdmon.pid start program = "/etc/init.d/collectd start" stop program = "/etc/init.d/collectd stop" # # cron # check process crond with pidfile /var/run/crond.pid start program "/etc/init.d/cron start" stop program "/etc/init.d/cron stop" # # dbus # check process dbus with pidfile /var/run/dbus/pid start program "/etc/init.d/dbus start" stop program "/etc/init.d/dbus stop" # # dropbear # check process dropbear with pidfile /var/run/dropbear.pid start program "/etc/init.d/dropbear start" stop program "/etc/init.d/dropbear stop" # if failed port 222 protocol ssh for 5 cycles then restart # # mdadm # check process mdadm with pidfile /var/run/mdadm/monitor.pid start program "/etc/init.d/mdadm start" stop program "/etc/init.d/mdadm stop" # # MySQL: check for correct PID file # check process mysqld with pidfile /var/run/mysqld/mysqld.pid start program = "/etc/init.d/mysql start" with timeout 60 seconds stop program = "/etc/init.d/mysql stop" # if failed host localhost port 3306 protocol mysql for 5 cycles then restart # # OpenSSH # check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/ssh start" stop program "/etc/init.d/ssh stop" # # Postfix # check process postfix with pidfile /var/spool/postfix/pid/master.pid start program = "/etc/init.d/postfix start" stop program = "/etc/init.d/postfix stop" # if failed port 25 protocol smtp for 5 cycles then restart # # rsyslog # check process rsyslogd with pidfile /var/run/rsyslogd.pid start program "/etc/init.d/rsyslog start" stop program "/etc/init.d/rsyslog stop" ## Gentoo Linux ## # # Apache # check process apache with pidfile /var/run/apache2.pid start program = "/etc/init.d/apache2 start" with timeout 60 seconds stop program = "/etc/init.d/apache2 stop" # if cpu > 80% for 5 cycles then restart # if failed host localhost port 80 protocol http for 5 cycles then restart # MySQL: check for correct PID file # check process mysqld with pidfile /var/run/mysqld/mysqld.pid start program = "/etc/init.d/mysql start" with timeout 60 seconds stop program = "/etc/init.d/mysql stop" # if failed host localhost port 3306 protocol mysql for 5 cycles then restart # # Postfix # check process postfix with pidfile /var/spool/postfix/pid/master.pid start program = "/etc/init.d/postfix start" stop program = "/etc/init.d/postfix stop" # if failed port 25 protocol smtp for 5 cycles then restart # # OpenSSH # check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/sshd start" stop program "/etc/init.d/sshd stop" # if failed port 22 protocol ssh for 5 cycles then restart # # collectd # check process collectd with pidfile /var/run/collectd/collectd.pid start program = "/etc/init.d/collectd start" stop program = "/etc/init.d/collectd stop" # # vixie-cron # check process crond with pidfile /var/run/crond.pid start program = "/etc/init.d/vixie-cron start" stop program = "/etc/init.d/vixie-cron stop" # # dcron # check process crond with pidfile /var/run/crond.pid start program = "/etc/init.d/dcron start" stop program = "/etc/init.d/dcron stop" # # cronie # check process cronie with pidfile /var/run/crond.pid start program = "/etc/init.d/cronie start" stop program = "/etc/init.d/cronie stop" # # fcron # check process crond with pidfile /var/run/fcron.pid start program = "/etc/init.d/fcron start" stop program = "/etc/init.d/fcron stop" # # rsyslog # check process syslog with pidfile /var/run/rsyslogd.pid start program = "/etc/init.d/rsyslog start" stop program = "/etc/init.d/rsyslog stop" # # syslog-ng # check process syslog with pidfile /var/run/syslog-ng.pid start program = "/etc/init.d/syslog-ng start" stop program = "/etc/init.d/syslog-ng stop" # # dbus # check process dbus with pidfile /var/run/dbus.pid start program "/etc/init.d/dbus start" stop program "/etc/init.d/dbus stop" # # dropbear # check process dropbear with pidfile /var/run/dropbear.pid start program "/etc/init.d/dropbear start" stop program "/etc/init.d/dropbear stop" # if failed port 222 protocol ssh for 5 cycles then restart # Samba # check process smbd with pidfile /var/run/samba/smbd.pid start program "/etc/init.d/samba start" stop program "/etc/init.d/samba stop"