A container running monit for the purpose of monitoring other containers.
docker create \
--name=monit \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/London \
-e MMONIT_URL="https://USERID:PASSWORD@mmonit.your.domain:2812/collector"
--expose 2812 \
-v </path/to/appdata/config>:/config \
--restart unless-stopped \
jchonig/monit
Compatible with docker-compose v2 schemas.
---
version: "2"
services:
monit:
image: jchonig/monit
container_name: monit
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/London
- MMONIT_URL="https://USERID:PASSWORD@mmonit.your.domain:2812/collector"
volumes:
- </path/to/appdata/config>:/config
expose:
- 2812
restart: unless-stopped
| Volume | Function |
|---|---|
| 2812 | Used by M/Monit to communicate with this instance of Monit |
XXX - Security
| Env | Function |
|---|---|
| PUID=1000 | for UserID - see below for explanation |
| PGID=1000 | for GroupID - see below for explanation |
| TZ=UTC | Specify a timezone to use EG UTC |
| MMONIT_URL | URL used to communicate with M/Monit |
| Volume | Function |
|---|---|
| /config | All the config files reside here |
- Environment variables can also be passed in a file named
envin theconfigdirectory. This file is sourced by the shell. - Monit configuration is assembled from config files found in
config/monit.d. - If it does not exist,
config/monit.d/httpis used created to specify the port Monit listens on. - If
MMONIT_URLis passed in the environment,config/monit.d/mmonitis created using this variable as the parameter to aset mmonitdirective.
If the file config/monit.d/http is not present on startup, this file
will be created with the following content
set httpd port 2812
allow localhost
allow ${NETWORK}/${NETMASK}
Where NETWORK and NETMASK are those of the container.
If the environment variable MMONIT_URL is defined, the file
config/monit.d/mmonit is created with the following content:
set monit ${MMONIT_URL}
- Document configuration
- Document alpine monit version issues