Monthly Archives: January 2015

Installing and Configuring Monit on Ubuntu Server

Run the following to install:

sudo apt-get install monit

To configure, open the file

sudo nano /etc/monit/monitrc

I added the following to the file to monitor the user and system CPU usage. Not sure if this will work yet.

check system localhost    
    start program = "/opt/zimbra/bin/zmcontrol start"
        as uid zimbra and gid zimbra
    stop program = "/opt/zimbra/bin/zmcontrol stop"
        as uid zimbra and gid zimbra            
    if cpu usage (system) > 99% for 5 cycles then restart    
    if cpu usage (user) > 99% for 5 cycles then restart

Setup the Http server so you can check status remotely

 set httpd port 2812
    use address ipaddress
    allow user:pw

If you have csf installed, make sure you update your csf config file to open up port 2812

vi /etc/csf/csf.conf

and then to reload csf

csf -r

Reload monit

monit reload

Check monit status

monit status