How to Install and Configure M/Monit on RHEL X86_64 step by setp

Summary: In this article I tried to explain how to install and configure M/Monit on CentOS Server to monitor different types of services.

Monit and M/Monit are used as a monitoring tools in combinations. Monit is used in backend and can be managed from terminal while M/Monit expand upon Monit’s capabilities and used as web interface to monitoring and management for all hosts enabled by Monit.
The current version we are going to use required Monit 5.2 or later as a backend agent. Monit can be downloaded from
See Supported Platforms for the exact OS versions supported by the binaries.

To install M/Monit:

Step-1: First, check that M/Monit is supported on your OS platform

Step-2: Get the latest release from

Step-3: Download and unpack the tar.gz file in a directory, any directory will do,
but unpacking in /opt or /usr/local are good choices.

Step-4: Go to the unpacked mmonit- directory

Step-5: Run M/Monit using:


Step-6: Point your Browser to the host where monit is installed (or “localhost” if running on the same machine), for example: http://localhost:8080/
and login as user “admin” with password “swordfish”.

You can run mmonit as any user, including root. It is not necessary to create a standalone account to run mmonit.

Step-7:Now do some changes on monit configuration files to connect both the servers.

vim /etc/monit.d/monitrc

Add the following entries at the top of every files you want to monitor.

set eventqueue basedir /var/monit/ slots 1000
set mmonit http://monit:monit@
set httpd port 2812 and use address
allow localhost
allow admin:secret

Assume we have the machines above where M/Monit runs on and listen on port 8080. And Monit runs on
and listen on port 2812.

If both are running on the same server then both all the three IP’s will be same are you can you can use

If you are working on cloud servers they are using private IP addresses, by attempting your server primary live IP you would never going to successfully connect both the servers.

For that you have to ask your service porvider, if you don’t know your server secondry IP address which is the Private IP. and Put the Private IP Address in line number 2 of the above step-6.
In Line 3 put the name of your server serverweb in place of IP address.

Then allow your live IP address to connect through.

Step-8:If you have a firewall then, you also have to permit access for port 80 and port 2812 by creating policy, otherwise you will be unable to access your application.

Step-9:If you have more than 20 hosts to monitor through M/Monit then you have to change the default sqlite database to Postgresql or Mysql.

Setps are listed here but i am using sqlite because i am monitoring not that much hosts.
Setting up M/Monit to use either MySQL or PostgreSQL is a simple two step process:

step-1:Create the M/Monit database. The database schemas can be found in mmonit/db/ Use one of the following recipes:


1) Create the mmonit database: mysqladmin create mmonit -u root -p
2) Create the mmonit user and grant access to the mmonit database:
GRANT ALL ON mmonit.* to mmonit@localhost identified by ‘ ‘
3) Create the schema: mysql -u mmonit mmonit -p < mmonit-schema.mysql


1) Create a mmonit postgres user: createuser -U postgres -P mmonit
2) Create the mmonit database: createdb -U postgres -E utf8 -O mmonit mmonit
3) Create the schema: psql -U mmonit mmonit < mmonit-schema.postgresql

step-2:Configure M/Monit; edit the M/Monit configuration file mmonit/conf/server.xml and replace the SQLite element with either.

This one for MySQL:

Or this one for PostgreSQL:

That is it. When you start M/Monit it connects to the configured database system.

Step-10: After Completing this Exercise restart you monit server

/etc/init.d/monit restart

Step-11: Check from log the successful connectivity with MMonit server.

Step-12: Open your browser and access the link

password: as listed in M/Monit installation

you will see the dashboard with your host server statistics.

That’s all about the M/Monit.

Leave a Reply

Your email address will not be published. Required fields are marked *