Try Monit to manage your daemons

Hello there,
I’m sorry for not updating my blog more often. Now is the time to use the best excuse in the world that will make me look like a busy businessman and you will all be impressed. Here we go : I don’t have the time!
I know a lot of you are using GOD to keep your daemons / processes alive. I really don’t want to say bad things about GOD (I can’t because I never tried it)… but I DID read some really nasty things about it and somehow it convinced me to try an alternative : Monit.
The biggest advantage with Monit is that it is written in C instead of ruby… so it doesn’t leak and it appears to be faster. It is also pretty easy to configure. Here is a very basic monit configuration file:

set daemon 60
set httpd port 2812 address localhost
     allow localhost
check process my_process
  with pidfile /home/apps/someapp/my_process.pid
  start program = "/home/apps/someapp/my_process start"
  stop program = "/home/apps/someapp/my_process stop"

Then, you start the monit daemon by typing : monit
It will poll the monit configuration file every minute (this is the set daemon 60 part) and will restart ‘my_process’ whenever it is not running. Of course this is an extremely simple use case and there are a lot more configuration options you can play with. Have a look at the documentation for more info.

4 thoughts on “Try Monit to manage your daemons

  1. I’ve tried god a couple of times. While I don’t agree with the language used in the post you linked with, I would agree that monit is easier to setup and has better stability. I quite like the small web based interface included with monit.

Leave a Reply

Your email address will not be published. Required fields are marked *