Table of Contents

Up and running in 30s or more


To install M/Monit:

 1. First, check that M/Monit is supported on your OS platform
 2. Get the latest release from  
 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.
 4. Go to the unpacked mmonit-<version> directory
 5. Run M/Monit using: ./bin/mmonit
 6. Point your Browser to the host where mmonit is installed (or "localhost"     
    if running on the same machine), for example: http://localhost:8080/
    and login as user "admin" with password "swordfish".

Once started, mmonit will daemonize itself and run in the background. To stop mmonit use ./bin/mmonit stop. To see all options for the mmonit program use ./bin/mmonit -h.

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

Database setup


M/Monit comes bundled and configured with SQLite as its database system. No extra setup is required. If you plan to use M/Monit to monitor more than, say 40-50 hosts, you may want to use MySQL or PostgreSQL instead as these database systems are faster and scale much better. If in doubt, start with SQLite.

If you later should want to switch to MySQL or PostgreSQL, you can use the migrate script in the upgrade directory to move your SQLite data over to MySQL or PostgreSQL.

Setting up M/Monit to use either MySQL or PostgreSQL is a simple:

Step 1

Stop M/Monit

Step 2

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 '<password>'
 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 3

Configure M/Monit: edit the M/Monit configuration file conf/server.xml and replace the SQLite <Realm> element with either:

This one for MySQL:

 <Realm url="mysql://mmonit:mmonit@" 
       reapConnections="300" />  

Or this one for PostgreSQL:

 <Realm url="postgresql://mmonit:mmonit@" 
       reapConnections="300" />

Adjust username, password, host and port number in the connection URL as required.

The URL in the <Realm> element specify a database connection on the standard URL format. The format of the connection URL is defined as: database://[user:password@][host][:port]/database[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]... Properties depends on the database server in question. If port number is omitted, the default port number for the database server is used.

Step 4

If you want to migrate the data:

    cd <mmonit's directory>


    ./db/ -t mysql | mysql -u mmonit mmonit -p


    ./db/ -t postgresql | psql -U mmonit mmonit 2>&1 | grep ERROR

Step 5

Start M/Monit. It will connect to the configured database system.

Automatic startup


Using Monit

You can register M/Monit as Monit service in the Monit configuration file (/etc/monitrc):

 check process mmonit with pidfile /usr/local/mmonit/logs/
   start program = "/usr/local/mmonit/bin/mmonit" 
   stop program = "/usr/local/mmonit/bin/mmonit stop"

And reload monit configuration:

 monit reload

Using systemd

Save this systemd unit file as /etc/systemd/system/mmonit.service

 Description = Easy, proactive monitoring of Unix systems, network and cloud services
 After =

 ExecStart = /opt/mmonit/bin/mmonit -i
 ExecStop = /opt/mmonit/bin/mmonit stop
 PIDFile = /opt/mmonit/logs/
 Restart = on-abnormal

 WantedBy =

Reload systemd configuration, enable M/Monit on boot and start it:

 systemctl daemon-reload
 systemctl enable mmonit
 systemctl start mmonit

Using Upstart

Configuration for upstart (older versions of Ubuntu/Debian):

Save this script as /etc/init/mmonit.conf

 # This is an upstart script to keep mmonit running.
 # Put this script here:
 #   /etc/init/mmonit.conf
 # and reload upstart configuration:
 #   initctl reload-configuration
 # You can manually start and stop monit like this:
 # start mmonit
 # stop mmonit

 description "M/Monit system monitoring"

 limit core unlimited unlimited

 start on runlevel [2345]
 stop on runlevel [!2345]

 expect daemon

 exec /usr/local/mmonit/bin/mmonit

 pre-stop exec /usr/local/mmonit/bin/mmonit stop

Reload upstart configuration and start M/Monit:

 initctl reload-configuration
 start mmonit
Page last modified on January 26, 2017, at 10:25 PM CET

Copyright © 2017 Tildeslash Ltd. All Rights Reserved.