Setting up an M/Monit docker container

Introduction

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,

app=mmonitprod
docker ps -a | grep $app
docker run -d --name $app -h $app \
        -p 80XX:8080 -p 84XX:8443 \
            --link mariadbprod:mariadb \
        custom/ubuntu
            #mmonitprod.<datetag>.ready
docker ps -a | grep $app
docker logs $app

Enter the container,

app=mmonitprod
docker exec -ti $app bash

Preparing MariaDB instead

Note. default is SQLite

Prepare the MariaDB database,

pwgen
    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.

Ref. https://mmonit.com/wiki/MMonit/Setup

Populate the DB,

apt -y update
apt -y full-upgrade
cat /etc/hosts
mysql -ummonit -pSOME_MARIA_PASSWORD -h mariadb mmonit
^D
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,

http://dockerhost.example.com:80XX/index.csp
https://dockerhost.example.com:84XX/index.csp

"admin" with password "swordfish"

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

https://dockerhost.example.com/index.csp

"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";
bin/mmonit

Operating Docker Containers

References

https://mmonit.com/ https://mmonit.com/documentation/mmonit_manual.pdf

Alternatives

https://github.com/antoniopuero/open-m-monit https://github.com/cw-ansible/cw.mmonit https://github.com/joealcorn/mmonit


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun