I started using monit for monitoring and automatically restaring process on some linux servers.
That is working quite well and you can find an easy setup guide here.
This is my setup in the /etc/monit/monitrc config file, to monitor and restart an open xchange server.
check system localhost
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
check process open-xchange with pidfile /var/run/open-xchange.pid
start program = „/etc/init.d/open-xchange start“
stop program = „/etc/init.d/open-xchange stop“
It alerts about the status of the server, and if it doesn’t find a running service, it restarts it.