Introduction
Monit is a utility for managing and monitoring processes, files, directories and filesystems on a Unix system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. E.g. Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources. You may use Monit to monitor files, directories and filesystems for changes, such as timestamps changes, checksum changes or size changes.
Installation
monit can be installed with the Pakfire web interface or via the console:
pakfire install monit
Usage
There is a separate web interface and it is not part of the IPFire WebGUI. The monit addon web interface will need to be configured.
Configuration
The monit addon uses a configuration file at /etc/monitrc
.
Examples
Monitor ntpd process
# IPFire - monit control file - ntpd
check process ntpd with pidfile /var/run/ntpd.pid
start program = "/etc/init.d/ntp start"
stop program = "/etc/init.d/ntp stop"
if not exist then alert
if not exist for 2 cycles then restart
if 3 restarts within 3 cycles then alert
Monitor unbound process
# IPFire - monit control file - unbound
check process unbound with pidfile "/var/run/unbound.pid"
not every "25-40 1 * * *"
start program = "/etc/init.d/unbound start"
stop program = "/etc/init.d/unbound stop"
if not exist then alert
if not exist for 2 cycles then restart
if 3 restarts within 3 cycles then alert
Monitor pmacct process
# IPFire - monit control file - pmacct
check process pmacct matching "pmacctd"
start program = "/etc/init.d/pmacct start"
stop program = "/etc/init.d/pmacct stop"
#restart program = "/etc/init.d/pmacct restart"
if not exist then alert
if not exist for 2 cycles then restart
if 5 restarts within 5 cycles then timeout
Monitor network interfaces
# IPFire - monit control file - green0
check network green0 with interface green0
if link down then alert
# IPFire - monit control file - blue0
check network blue0 with interface blue0
if link down then alert
# IPFire - monit control file - orange0
check network orange0 with interface orange0
if link down then alert
# IPFire - monit control file - red0
check network red0 with interface red0
if link down then alert
Links
- Monit manpage
- Monit slideshow
- Monit - Real-world configuration examples
- IPFire Community - Installation of Monit and access to webinterface
Note - Thank you to Matthias for various monit examples!