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 -uroot -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

see setting up mmonit

alternatively, you can also start the daemon from the docker host as such,

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