Home /  MMonit /  Setup

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 https://mmonit.com/download/
  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. Example:
    tar -xzf mmonit-4.0.0-linux-x64.tar.gz
  1. Go to the unpacked mmonit-<version> directory
  2. Run M/Monit using: ./bin/mmonit
  3. 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.

  • M/Monit requires Monit as an agent. Please see the M/Monit Manual (page 16) on how to setup Monit to report data to M/Monit.

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 mmonit/db directory to move your SQLite data over to MySQL or PostgreSQL.

Follow these steps to configure M/Monit to use either MySQL or PostgreSQL:

  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:
     CREATE USER mmonit@localhost IDENTIFIED BY '<password>';
     GRANT ALL ON mmonit.* to mmonit@localhost;
 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
  1. 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.

Re-start M/Monit to 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/mmonit.pid
   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 = network.target
 Documentation= https://mmonit.com/documentation/ 

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

 WantedBy = multi-user.target

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

macOS Installer

On macOS, M/Monit is installed via an installer package. The installer, copies M/Monit into /usr/local/mmonit as the user running the installer. Only this user can run the mmonit binary because the sqlite database in /usr/local/mmonit/db/mmonit.db can only be opened by this user due to file permissions. If you need to run mmonit as another user, just use the command line to change the owner of /usr/local/mmonit:

  sudo chown -R user /usr/local/mmonit

This command will change the owner of the mmonit directory and all its files to user. Replace user with a user on your system.