Latest Monit setup on Ubuntu



apt-get install monit

Following installs Monit 5.3 on Ubuntu 12.04. Which is very old!

Binary Install

Go to and pick correct binary for your system. Following lines will install Monit 5.14 for Ubuntu 64-bit.

cd ~
tar zxvf monit-5.14-linux-x64.tar.gz
cd monit-5.14/
cp bin/monit /usr/bin/monit
mkdir /etc/monit
touch /etc/monit/monitrc
chmod 0700 /etc/monit/monitrc 
ln -s /etc/monit/monitrc /etc/monitrc
wget -P /etc/init.d/
chmod u+x /etc/init.d/monit
echo "START=yes" > /etc/default/monit
monit -t


Monit Config File

Add/Update following in /etc/monit/monitrc

#Monitoring Interval in Seconds
set daemon  60

#Enable Web Access
set httpd port 2812
     allow admin:easyengine

#Event Queue for 5000 events
set eventqueue basedir /var/monit slots 5000

#MySQL Monitoring
check process mysqld with pidfile "/var/run/mysqld/"              
    if cpu > 80% for 2 cycles then alert

check process php5-fpm with pidfile "/var/run/"
    if cpu > 80% for 2 cycles then alert

check process nginx with pidfile "/var/run/"
    if cpu > 80% for 2 cycles then alert

#System Monitoring 
    if memory usage > 80% for 2 cycles then alert
    if cpu usage (user) > 70% for 2 cycles then alert
        if cpu usage (system) > 30% then alert
    if cpu usage (wait) > 20% then alert
    if loadavg (1min) > 6 for 2 cycles then alert 
    if loadavg (5min) > 4 for 2 cycles then alert
    if swap usage > 5% then alert

check filesystem rootfs with path /
       if space usage > 80% then alert
set mailserver localhost
set alert [email protected]

##mmonit (optional)
#set mmonit http://user:pass@IP:port/collector

You may also wish to change username admin and password easyengine. Also, change numbers 6 and 4 in loadavg lines based on number of CPU cores on your system.


First test your config using monit -t command. Then start monit using service monit start


Run command  monit status, it should something like:

The Monit daemon 5.13 uptime: 2m 

System ''
  status                            Running
  monitoring status                 Monitored
  load average                      [0.48] [0.40] [0.81]
  cpu                               0.0%us 0.0%sy 0.0%wa
  memory usage                      8276900 kB [25.1%]
  swap usage                        1192 kB [0.0%]
  data collected                    Thu, 03 Apr 2014 10:41:45

#many more lines...

You may also open in your browser to use web-based interface.


You can use commercial version M/Monit for a lot many features or free script monit-graph

Install monit-graph

cd /var/www/
git clone mg
cd mg
chmod -R 0777 data
chmod 0644 data/index.php

Config File

Open config.php and adjust following values:

"url" => "localhost:2812",   
"url_ssl" => false,
"http_username" => "admin",
"http_password" => "easyengine",

Setup Cron

Add following line to cron:

* * * * * php /var/www/ >> /var/log/monit-graph.log

View Graphs

You can open in browser to see visual graphs!


  1. monit check program for custom script to monitor php5-fpm status page and nginx status page.
  2. Explore:
  3. Explore: