Monit is a a free open source utility for managing and monitoring, processes, programs, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.
How to enable Monit?
Recent versions of BitNami stacks ship Monit configuration files for all servers. If you are using a Virtual Machine or Cloud Image, Monit is already configured and enabled by default. Note the following is only valid for Linux platforms.
Check the Monit files in the installdir/config/monit folder. If you are using a Virtual Machine or a Cloud Image, installdir is the /opt/bitnami folder.
You can enable Monit in your machine creating a symbolic link. It is necessary to have already installed Monit from the repositories. For example, in Ubuntu:
$ sudo apt-get install monit $ sudo ln -s installdir/config/monit/bitnami.conf /etc/monit/conf.d/bitnami.conf
For RedHat, CentOS or AWS Linux:
$ sudo yum install monit $ sudo ln -s installdir/config/monit/bitnami.conf /etc/monit.d/bitnami.conf
Note: If you do not find Monit package in your repositories, add the EPEL repository in your repository list.
How to check Monit configuration?
You can simply check the servers status with the following command:
$ sudo monit status
At this point you should see the servers that Monit is monitoring and the machine stats:
The Monit daemon 5.5.1 uptime: 1d 19h 35m Process 'mysql' status Running monitoring status Monitored pid 27154 parent pid 26893 uptime 1m children 0 memory kilobytes 38428 memory kilobytes total 38428 memory percent 0.2% memory percent total 0.2% cpu percent 0.0% cpu percent total 0.0% data collected Thu, 15 Aug 2013 13:39:06 Process 'apache' status Running monitoring status Monitored pid 27205 parent pid 1 uptime 1m children 8 memory kilobytes 13500 memory kilobytes total 86504 memory percent 0.0% memory percent total 0.5% cpu percent 0.0% cpu percent total 0.0% data collected Thu, 15 Aug 2013 13:39:06 System 'desktop' status Running monitoring status Monitored load average [0.14] [0.21] [0.22] cpu 0.9%us 0.7%sy 0.0%wa memory usage 7113496 kB [43.5%] swap usage 182008 kB [1.1%] data collected Thu, 15 Aug 2013 13:39:06
Monit is also includes a small httpd application where you can manage the servers. It only works from localhost by default but you can add your IP address in the "/installdir/config/monit/bitnami.conf" configuration file:
# BitNami configuration file for Monit. set httpd port 2812 and use address localhost allow localhost include installdir/config/monit/conf.d/*.conf
If you have installed the stack in your own machine, you can access to the Monit Server Manager at http://localhost:2812
How to configure my server with Monit?
You can find all Monit configuration files for the Bitnami servers in the "installdir/config/monit/conf.d" folder. For example, the Apache Monit config file:
check process apache with pidfile "/installdir/apache2/logs/httpd.pid" start program = "/installdir/apache2/scripts/ctl.sh start" with timeout 90 seconds stop program = "/installdir/apache2/scripts/ctl.sh stop"
$ sudo monit reload
How to disable Monit?
If you want to disable one server, you can run the following comand to disable it. For example, Apache server:
$ sudo monit unmonitor apache
You can also stop the monit process with the following command:
$ sudo monit quit