Sign inSign up

jchonig/monit

By jchonig

Updated 6 days ago

Monit in a container to monitor other containers

Image
0

4.7K

jchonig/monit repository overview

docker-monit

A container running monit for the purpose of monitoring other containers.

Image hosted at: ghcr.io/jchonig/monit

Usage

docker

docker create \
  --name=monit \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/London \
  -e MMONIT_URL="https://USERID:[email protected]:2812/collector"
  --expose 2812 \
  -v </path/to/appdata/config>:/config \
  --restart unless-stopped \
  ghcr.io/jchonig/monit
docker-compose

Compatible with docker-compose v2 schemas.

---
version: "2"
services:
  monit:
    image: ghcr.io/jchonig/monit
    container_name: monit
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - MMONIT_URL="https://USERID:[email protected]:2812/collector"
    volumes:
      - </path/to/appdata/config>:/config
    expose:
      - 2812
    restart: unless-stopped

Parameters

Ports (--expose)

VolumeFunction
2812Used by M/Monit to communicate with this instance of Monit

XXX - Security

Environment Variables (-e)

EnvFunction
PUID=1000for UserID - see below for explanation
PGID=1000for GroupID - see below for explanation
TZ=UTCSpecify a timezone to use EG UTC
MMONIT_URLURL used to communicate with M/Monit

Volume Mappings (-v)

VolumeFunction
/configAll the config files reside here

Application Setup

  • Environment variables can also be passed in a file named env in the config directory. 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/http is used created to specify the port Monit listens on.
  • If MMONIT_URL is passed in the environment, config/monit.d/mmonit is created using this variable as the parameter to a set mmonit directive.

Local port

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.

M/Monit connection

If the environment variable MMONIT_URL is defined, the file config/monit.d/mmonit is created with the following content:

set monit ${MMONIT_URL}

TODO

  • Document configuration
  • Document alpine monit version issues

Tag summary

Content type

Image

Digest

sha256:64168cb76

Size

12 MB

Last updated

6 days ago

docker pull jchonig/monit