Stalling programs and a workaround with Monit

Since a couple of month I have problem with stalling programs. That is namely Webmin and Usermin (several times a day) and sometimes Postfix and Dovecot.

Since I didn’t manage to find the root or the problem I installed Monit according to this site:

http://www.howtoforge.com/server-monitoring-with-munin-and-monit-on-centos-5.2-p2

I did following config:

[code:1]
set daemon 60
set logfile syslog facility log_daemon
set mailserver localhost
set mail-format { from: Monit@example.com }
set alert just_me@example.com

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

check process dovecot with pidfile /var/run/dovecot/master.pid
group mail
start program = "/etc/init.d/dovecot start"
stop program = "/etc/init.d/dovecot stop"
if failed port 25 protocol smtp then restart
if 5 restarts within 5 cycles then timeout

check process usermin with pidfile /var/usermin/miniserv.pid
start program = "/etc/init.d/usermin start"
stop program = "/etc/init.d/usermin stop"
group misc
if failed host 127.0.0.1 port 0000 type tcp then restart
depends usermin_init

check file usermin_init with path /etc/init.d/usermin
group misc

check process webmin with pidfile /var/webmin/miniserv.pid
start program = "/etc/init.d/webmin start"
stop program = "/etc/init.d/webmin stop"
group misc
if failed host 127.0.0.1 port 20000 type tcp then restart
depends webmin_init

check file webmin_init with path /etc/init.d/usermin
group misc[/code:1]

So far everything works fine and keeps alive.