HUB
Sign inSign up

meddream/mdmonitor

By meddream

•Updated 4 days ago

Health, capacity, and tuning monitor for MedDream servers, with a web UI

Image
Monitoring & observability
1

369

meddream/mdmonitor repository overview

⁠mdMonitor

Health, capacity and tuning monitor for one or more MedDream servers, with a web UI.

mdMonitor reads MedDream's management endpoint (/manage, Spring Boot Actuator), keeps the readings in a database of its own, and answers four questions instead of showing a thousand numbers:

  • Alive - is it up, and has it stayed up?
  • Stuck - is a thread pool, lock, scheduled job or database pool wedged?
  • Struggling - are users waiting, is work piling up, is a resource running out?
  • Capacity - would more CPU, RAM or threads actually help? One sentence.

It only reads from MedDream, with one exception: the Logs tab's Logging level dialog changes a logger's level when you ask it to, and puts it back after 60 minutes.

⁠Quick start

docker run -d --name mdmonitor \
  -p 8090:8090 \
  -v mdmonitor-data:/data \
  -e MDMONITOR_MANAGE_URL=http://meddream.example:8081/manage \
  -e MDMONITOR_MANAGE_USER=admin \
  -e MDMONITOR_MANAGE_PASSWORD=change-me \
  meddream/mdmonitor:latest

Open http://<docker host>:8090 and log in with admin / admin. Every page shows a red warning until you change that password (see Login).

With only these variables, mdMonitor monitors one instance and shows live data, but keeps no history. Add a database (see Docker Compose) for charts over time, the Logs tab and Export diagnostics.

⁠Docker Compose with PostgreSQL

services:
  mdmonitor:
    image: meddream/mdmonitor:latest
    restart: unless-stopped
    ports:
      - "8090:8090"
    volumes:
      - ./data:/data
    environment:
      MDMONITOR_DB_ENABLED: "true"
      MDMONITOR_DB_ENGINE: postgresql
      MDMONITOR_DB_HOST: db
      MDMONITOR_DB_USER: mdmonitor
      MDMONITOR_DB_PASSWORD: change-me
      MDMONITOR_DB_NAME: mdmonitor
    depends_on:
      - db

  db:
    image: postgres:18
    restart: unless-stopped
    environment:
      POSTGRES_USER: mdmonitor
      POSTGRES_PASSWORD: change-me
      POSTGRES_DB: mdmonitor
    volumes:
      - ./postgresql:/var/lib/postgresql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U mdmonitor -d mdmonitor"]
      interval: 5s
      timeout: 5s
      retries: 10

Put the MedDream instances in ./data/config.json (below), or add them from the Configure instances page once mdMonitor is running. MySQL / MariaDB work too: set MDMONITOR_DB_ENGINE: mysql. mdMonitor creates its tables on startup and upgrades them when you pull a newer image. It needs a database of its own; never point it at MedDream's.

⁠The /data volume

PathWhat it is
/data/config.jsonAll settings: instances, database, login, log collection. Holds passwords.
/data/favorites.jsonFavourite charts.
/data/diagnostics/Recorded diagnostics bundles.

The Configure instances and Logs pages write to config.json, so mount /data writable. If there is no config.json, defaults and environment variables apply; the first save from the Configure instances page creates the file.

A minimal config.json for two servers:

{
  "instances": [
    { "key": "prod1", "label": "Production",
      "url": "http://10.0.0.10:8081/manage",
      "username": "admin", "password": "..." },
    { "key": "test", "label": "Test",
      "url": "https://10.0.0.20:8087/manage",
      "username": "admin", "password": "...", "verify_tls": false }
  ],
  "database": { "enabled": true, "engine": "postgresql", "host": "db",
                "user": "mdmonitor", "password": "...", "database": "mdmonitor",
                "retention_days": 7 },
  "auth": { "username": "admin", "password": "pbkdf2_sha256$..." }
}
  • key is the instance's permanent identity: history is stored under it, so do not change it once data exists. label is the name people see; change it freely.
  • verify_tls: false skips the certificate check, for example when MedDream is reached by IP address or through a tunnel. The connection stays encrypted.
  • retention_days (default 7) - older samples are deleted hourly.

⁠Environment variables

Each one overrides a single value in config.json.

VariableSets
MDMONITOR_MANAGE_URL, _USER, _PASSWORD, MDMONITOR_VERIFY_TLS, MDMONITOR_REQUEST_TIMEOUTThe MedDream instance - only when exactly one is configured
MDMONITOR_DB_ENABLED, _ENGINE, _HOST, _PORT, _USER, _PASSWORD, _NAME, _CREATE, _RETENTION_DAYSThe history database (_ENGINE: mysql or postgresql)
MDMONITOR_LIVENESS_INTERVAL, _METRICS_INTERVAL, _SCHEDULER_INTERVAL, _INFO_INTERVALPolling intervals in seconds (defaults 15, 20, 60, 300)
MDMONITOR_HISTORY_SECONDSHow much history is kept in memory (default 7200)
MDMONITOR_LOG_LEVELmdMonitor's own log level (default INFO)
MDMONITOR_CONFIGPath of config.json (the image sets /data/config.json)
MDMONITOR_WEB_HOST, MDMONITOR_WEB_PORTWeb address and port (the image sets 0.0.0.0 and 8090)

mdMonitor's own log goes to the container output: docker logs mdmonitor.

⁠Login

Every page needs a login except /healthz, which you can use for a container health check. The account is auth in config.json. To store a hash instead of the plain password:

docker run --rm -it meddream/mdmonitor:latest --hash-password

Paste the printed pbkdf2_sha256$... value as auth.password and restart the container. Five failed logins from one address lock it out for a minute. "auth": {"enabled": false} switches login off, only for a deployment that is already behind an authenticating proxy.

⁠What MedDream needs

MedDream ships with its management endpoints switched off. Set these in MedDream's application.properties (or as environment variables in its own container) and restart it. The ? MedDream setup button on mdMonitor's Configure instances page shows the full list, with a Copy button.

management.endpoints.enabled-by-default=true
management.endpoints.web.exposure.include=prometheus,health,info,scheduledtasks,httpexchanges,logfile,loggers,threaddump
authentication.manager.username=<manager user>
authentication.manager.password=<manager password>

The same as environment variables:

MANAGEMENT_ENDPOINTS_ENABLEDBYDEFAULT=true
MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE=prometheus,health,info,scheduledtasks,httpexchanges,logfile,loggers,threaddump
AUTHENTICATION_MANAGER_USERNAME=<manager user>
AUTHENTICATION_MANAGER_PASSWORD=<manager password>
EndpointFeedsNeeded?
prometheusevery metric: users, requests, queues, threads, CPU, memory, disksrequired
healthliveness ping and licence checkoptional
infoMedDream build and versionoptional
scheduledtasksscheduled tasks, hung or overdue onesoptional
httpexchangesthe slowest actual requests, with their URLsoptional
logfilethe Logs tab: MedDream's errors, explainedoptional
loggersthe Logs tab's Logging level dialogoptional
threaddumpthread dumps in an Export diagnostics recordingoptional

List the endpoints by name; do not use *, which also exposes shutdown, restart, env and heapdump. Any optional endpoint you leave out is shown as Not measured. Detect endpoints on the Configure instances page checks what a server actually serves.

Recommended too:

  • server.tomcat.mbeanregistry.enabled=true - shows Tomcat's busy request threads and open connections.
  • management.metrics.tags.key=spring - makes all of MedDream's thread pools visible, not only some.
  • management.endpoint.logfile.external-file=<path>/meddream.main.log - lets the Logs tab read MedDream's log.
  • management.metrics.system.diskspace.paths=<path 1>,<path 2> - free space on every disk MedDream writes to.
  • management.server.port=8081 - keeps /manage off the port users reach. Expose it only to mdMonitor, never to the internet.

⁠What you get

  • Dashboard per instance - status strip, users, requests, queues and thread pools, memory, CPU, disks, database pools, scheduled tasks, and a one-sentence capacity verdict.
  • History charts over ranges from minutes to days, and a Favourites tab for the charts you check most.
  • Logs - MedDream's errors grouped, with known ones named and explained. Personal data in log lines is masked before it is stored.
  • Logging level - raise a MedDream logger to DEBUG for a while; it goes back automatically after 60 minutes.
  • Export diagnostics - a zip of metrics, findings, log errors and thread dumps, from history or recorded live for 15, 30 or 60 minutes, ready to send to support. User names and IP addresses can be replaced with stable aliases.
  • TLS certificate expiry and disk space warnings per instance.

⁠Not included

  • No alerting or notifications - the UI and /api/status only.
  • One login account; no users or roles.

Tag summary

Content type

Image

Digest

sha256:b10d24dfa…

Size

54.4 MB

Last updated

4 days ago

docker pull meddream/mdmonitor