I set up
monit, a utility for monitoring services on a Unix system. My concrete use case is a FreeBSD machine, that runs "N2N Edge", a Peer-to-peer (P2P) virtual private network (VPN) software.
monitpretty much automates the "have you tried turning it off and on again?" process. Configurations like the following illustrate this:
Do you want to know more?
check process myproc matching "myproc" start program = "/etc/init.d/myprocstart" stop program = "/usr/bin/killall myproc" if cpu usage > 95% for 10 cycles then restart