Monit

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

Installing monit
The application has the following USE flags:

Once the USE flags are properly determined, install through :

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

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

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

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

After updating, can be immediately started through.

User management
Users added to the or  group will be able to manipulate  through its web interface.

To add users to one of these groups, use :

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  as admin username and   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 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 in the foreground and provide feedback on everything it is detecting, use the   option:

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


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