From Funtoo
Revision as of 04:44, June 27, 2014 by Threesixes (talk | contribs) (initial commit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search



We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

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



To install app-admin/monit:

root #emerge monit


Config file of monit resides in /etc/monitrc. And there is a item to specify a config directory. Uncomment if needed.

   /etc/monitrc - config dir
## It is possible to include additional configuration parts from other files or
## directories.
#  include /etc/monit.d/*


Users added to the monit or users group will be able to manipulate monit through the web interface.

root #gpasswd -a $USER monit
root #gpasswd -a $USER users

passwords can be streamed to monits web interface, disable it all together after it is setup


for security purposes change this entry

allow admin:monit

Boot Services



this is the preferred method to run monit

   /etc/inittab - auto restart monit in case of failure
ca:12345:ctrlaltdel:/sbin/shutdown -r now

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

# Used by /etc/init.d/xdm to control DM startup.

to start monit immediately after changing inittab

root #telinit q



prefer inittab method over rc services

To start the service at boot.

root #rc-update add monit default

To start the service immediately.

root #/etc/init.d/monit start

Monitoring Monit

This hourly cron script will check to make sure monit has not crashed. As this uses pgrep, make sure to not name it monit.

if ! pgrep monit >/dev/null;then
rc-service monit restart

Pidfile Check

Monit relies upon pid files. For daemons that do not create a pidfile: a work around is needed.


Auto Restart Mysql

   /etc/monitrc - auto restart mysql
check process mysql with pidfile /var/run/mysqld/
    start program = "/bin/bash -c 'rc-service mysql start'"
    stop program  = "/bin/bash -c 'rc-service mysql stop'"

Web Interface

Navigate to http://localhost:2812/ & login using your edited configuration line or admin / monit if you have not changed it yet.