Nethence NEWDOC OLDDOC Lab Webmail Your IP BBDock  

Setting up an M/Monit docker container


M/Monit is the web interface and the db (sqlite by default) collecting the data from the monit server-agents.

Launching the container

Run the container that will serve M/Monit,

docker ps -a | grep $app
docker run -d --name $app -h $app \
        -p 80XX:8080 -p 84XX:8443 \
            --link mariadbprod:mariadb \
docker ps -a | grep $app
docker logs $app

Enter the container,

docker exec -ti $app bash

Preparing MariaDB instead

Note. default is SQLite

Prepare the MariaDB database,

    mysqladmin create mmonit -u root -p
    GRANT ALL ON mmonit.* to mmonit identified by 'SOME_MARIA_PASSWORD';

Note. no @localhost: allowing remote connections as long as the daemon is binded to the network.


Populate the DB,

apt -y update
apt -y full-upgrade
cat /etc/hosts
mysql -ummonit -pSOME_MARIA_PASSWORD -h mariadb mmonit
mysql -ummonit -pSOME_MARIA_PASSWORD -h mariadb mmonit < /root/mmonit-3.6.2/db/mmonit-schema.mysql

Note. if you cannot reach the mariadb database, try with --protocol=TCP.

Installation & use MariaDB

Copy/paste the Linux x64 link from M/Monit download, e.g.,

cd ~/
tar xzf mmonit-3.6.2-linux-x64.tar.gz
ln -s mmonit-3.6.2 mmonit

Switch from SQLite to MariaDB/MySQL,

cd ~/mmonit/conf/
cp -i server.xml server.xml.dist
vi server.xml
<Realm url="mysql://mmonit:wohyoNe3@mariadb:3306/mmonit"
       reapConnections="300" />

Start the daemon, either from within the container,

ps auxfw | less

or from the docker host,

docker exec mmonitprod /root/mmonit/bin/mmonit
docker exec -ti mmonitprod ps auxfw | less

Ready to go

Make sure the service is listening from the docker host,

netstat -an --inet --inet6 | grep 80XX
netstat -an --inet --inet6 | grep 84XX

check the raw URL from the internal network,

"admin" with password "swordfish"

Setup the reverse-proxy and check with the public URL,

"admin" with newly defined password

Maintenance & Operations

Override admin password,

bin/mmonit stop
select uname,password from users;
echo -n PASSWORD | md5sum | tr 'a-z' 'A-Z'
update users set password="HASH" where uname="admin";

Operating Docker Containers