Get Monit to repair your server!

Monit is an open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit is capable of automatic maintenance and repair and can execute meaningful causal actions in error situations. It takes less than 15 minutes to setup and run this wonderful tool on most Unix servers. It also comes with a buit in web based service manager.

I personally prefer Monit over Nagios or ZABBIX. They are pain to install and not as flexible as Monit. AFAIK, Nagios only notifies and records events. It is unable to take a casual maintainance action such as restarting the service.

You will find some useful Monit scripts here.

My Kudos to the Monit team. I’m one happy Monit user 🙂

If you enjoyed this post, make sure you subscribe to my RSS feed!

7 thoughts on “Get Monit to repair your server!”

  1. Yes, I totally agree with you. Monit is so easy to setup & configure. The monitrc file is also very easy to understand & has a very simple syntax, much like pseudo code.

    One thing I haven’t figured out yet is how to make monit automatically start when the machine boots up & also to get the OS to automatically start monit, in case monit fails. The documentation talks about adding an /etc/inittab entry, but that did not work for me. I’m using Ubuntu 8.04. Has anybody managed to successfully do this?

  2. Azeez, you just have to symlink /etc/init.d/monit to /etc/rc4.d/S99monit. If you are running a desktop system make it /etc/rc5.d/S99monit because the system is in run-level 5 after booting.

    Hope this helps.

  3. No, it will only start Monit at start-up/entering the particular run level. Two days running Monit doesn’t look like it’s going down. You will have to monitor Monit 😛 (monitor the monitor) and restart the process should it go down.

  4. From the monit man page

    Monit can run and be controlled from init. If monit should crash, init will re-
    spawn a new monit process. Using init to start monit is probably the best way to
    run monit if you want to be certain that you always have a running monit daemon
    on your system. (It’s obvious, but never the less worth to stress; Make sure that
    the control file does not have any syntax errors before you start monit from
    init. Also, make sure that if you run monit from init, that you do not start
    monit from a startup scripts as well).

    To setup monit to run from init, you can either use the ’set init’ statement in
    monit’s control file or use the -I option from the command line and here is what
    you must add to /etc/inittab:

    # Run monit in standard run-levels
    mo:2345:respawn:/usr/local/bin/monit -Ic /etc/monitrc

    But that did not work for me

  5. I had to install the following before I could make monit.

    1. libssl-dev (apt-get install libssl-dev)
    2. flex (apt-get install flex)
    3. yacc ((apt-get install bison)

    Then from the dir where monit is extracted to, run the usual; ./configure, make, make install

    That’s it!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.