Monit checks the availability of services on your server and takes the appropriate action such as a restart if it finds a service is not behaving as expected. If you add/replace the following configuration to your /etc/monit/monitrc file, you can almost monitor any service on your Debian Etch server : Code: # Apache2 check process apache with pidfile /var/run/apache2.pid group www start program = "/etc/init.d/apache2 start" stop program = "/etc/init.d/apache2 stop" if failed host [COLOR="Red"]monitor.example.com[/COLOR] port 80 protocol http and request "/monit/token" then restart if cpu is greater than 60% for 2 cycles then alert if cpu > 80% for 5 cycles then restart if totalmem > [COLOR="Red"]700[/COLOR] MB for 5 cycles then restart if children > 500 then restart if loadavg(5min) greater than 10 for 8 cycles then stop if 3 restarts within 5 cycles then timeout # Courier_authdaemon check process authdaemon with pidfile /var/run/courier/authdaemon/pid group services start program = "/etc/init.d/courier-authdaemon start" stop program = "/etc/init.d/courier-authdaemon stop" if 5 restarts within 5 cycles then timeout # Bind check process bind9 with pidfile /var/lib/named/var/run/bind/run/named.pid group bind start program = "/etc/init.d/bind9 start" stop program = "/etc/init.d/bind9 stop" if failed port 53 then restart if 5 restarts within 5 cycles then timeout if failed port 53 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/cron start" stop program = "/etc/init.d/cron stop" group system depends cron_init, cron_bin check file cron_init with path /etc/init.d/cron group system check file cron_bin with path /usr/sbin/cron group system # Courier_imapd check process imap 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 restart 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 # MySQL check process mysql with pidfile /var/run/mysqld/mysqld.pid group database start program = "/etc/init.d/mysql start" stop program = "/etc/init.d/mysql stop" if failed host 127.0.0.1 port 3306 then restart if failed unix "/var/lib/mysql/mysql.sock" then restart if 5 restarts within 5 cycles then timeout 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 # 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 depends on postgrey # Postgrey check process postgrey with pidfile /var/run/postgrey.pid group postgrey start program = "/etc/init.d/postgrey start" stop program = "/etc/init.d/postgrey stop" # Courier_pop3d check process pop3 with pidfile /var/run/courier/pop3d.pid group mail start program = "/etc/init.d/courier-pop start" stop program = "/etc/init.d/courier-pop stop" if failed port 110 then restart if 5 restarts within 5 cycles then timeout # Courier_pop3-ssl check process pop3-ssl with pidfile /var/run/courier/pop3d-ssl.pid group mail start program = "/etc/init.d/courier-pop-ssl start" stop program = "/etc/init.d/courier-pop-ssl stop" if failed port 995 then restart if 5 restarts within 5 cycles then timeout # ProFTPd check process proftpd with pidfile /var/run/proftpd.pid start program = "/etc/init.d/proftpd start" stop program = "/etc/init.d/proftpd stop" if failed port 21 protocol ftp then restart if 5 restarts within 5 cycles then timeout # SSHd check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/ssh start" stop program "/etc/init.d/ssh 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 If you decide to copy and paste it into your monitrc file, the services will appear in alphabetical order within the monit application. Don't forget to replace monitor.example.com with your own domain name. Also change 700 on the line "if totalmem > 700 MB for 5 cycles then restart" in a suitable value for you. Of course, only configure the services you've running on your server. So for example, if you don't run postgrey, please don't mention it within your monitrc file. The syntax within the monitrc file can be verified by executing the command: monit -t After changing your monitrc file, restart monit with the command: /etc/init.d/monit restart
Hi Hans. Yes Monit is great! I've been using it for some time now. I used this howto to install it. http://www.howtoforge.com/server_monitoring_with_munin_monit_debian_etch One small tip. Stop Monit when you update ISPconfig, or Monit might start a service that needs to be off during an ISPconfig update!