Thursday, December 02, 2010

How to Install and Configure Monit on Linux for Process Monitoring

Monit is an open source utility that provides several system monitoring functionality that are extremely helpful to sysadmins. This article provides a jumpstart guide on monit installation and configuration. We also discuss a specific example related to processes monitoring.

1. Install monit
On Fedora, openSUSE, Debian install monit as a package from the distribution repository. For example, on Debian (and Ubuntu), install monit using apt-get as shown below.

# apt-get install monit

If your distribution don’t have the monit package, download monit source and install it.

2. Configure monit
A sample process monitoring entry in the monit configuration file /etc/monit/monitrc looks like the following.

check process PROCESSNAME
       with pidfile PIDFILENAME-WITHABSOLUTE-PATH
       start = STARTUP-SCRIPT
       stop = STOP-SCRIPT

For example, to monitor the cron daemon, append the following lines to the monitrc file.

# vim /etc/monit/monitrc
check process crond
           with pidfile /var/run/crond.pid
           start = "/etc/init.d/cron start"
           stop  = "/etc/init.d/cron stop"

Read more: The Geek Stuff