Monit

is a utility for managing and monitoring processes, programs, files, directories and filesystems on a UNIX system.

Installing monit
The application has two USE flags:

Once the USE flags are properly determined, install through emerge :

Monit configuration files
The Monit application uses as its configuration file.

To make adding and removing monitoring definitions easy, monit supports including files inside a specified directory (usually . To enable this, edit like so:

When a Monit related configuration file is altered, tell monit to reread its configuration settings:

Automatically starting monit at boot
It is recommended to start monit through the so that init itself launches the monit application, and will automatically relaunch it when monit would suddenly die. Starting monit through an init script would not provide this functionality.

After updating, monit can be immediately started through telinit q.

User management
Users added to the monit</tt> or users</tt> group will be able to manipulate monit</tt> through its web interface.

To add users to one of these groups, use gpasswd :

Inside the file, the   statement should refer to these groups, like so:

It is also possible to hard-code usernames and passwords in the file, but this is not recommended. Check the file for default passwords and remove those, or alter them to use a strong, unique password. The syntax used then is.

Monit web interface
The default location of the web interface is at localhost:2812, with admin</tt> as admin username and monit</tt> as default password. Make sure to change this!

Monitoring applications through monit
The Monit application uses PID file checks to see if an application is still running or not. That implies that a PID file must be available for an application, otherwise monit</tt> cannot guard it. If a daemon does not create a PID file, use a wrapper to create one.

Through using the location, it is easy to add in additional monitoring rules.

For instance, to automatically restart MySQL when it would die:

Another example is to manage the memory usage of a process and create an alert when it grows beyond a certain threshold:

Running monit in the foreground
To run monit</tt> in the foreground and provide feedback on everything it is detecting, use the -Ivv option:

External resources
For more information about Monit, the following resources can help out.


 * Monit official documentation
 * Monit Wiki
 * Configuring Monit for Avahi