Skip to main content

mtop

htop for Ollama — a curses-based TUI that monitors your models, GPU, and the Ollama server (in Docker or bare-metal) in real time. Zero flicker. Zero dependencies beyond Python 3.10+.

Python 3.10+ License: MIT Platform: Linux

Why?

There are web dashboards, Prometheus exporters, and chat TUIs for Ollama. But there's no terminal monitor — something you SSH into a box and just run, like htop or nvtop, to see what models are loaded, how much VRAM they're eating, and whether the container is healthy.

mtop fills that gap. One file, one command, pure stdlib Python. It auto-detects whether Ollama runs in a Docker container or as a bare-metal process (systemd or a manual ollama serve) and monitors it either way.

Features

  • Zero-flicker display — curses double-buffered rendering, no clear + print loops
  • Effective inference configRUNNERS section parses each runner's argv: context, batch, flash attention, KV cache dtype, layer offload. The only place these are observable
  • Whole-tree process stats — the server and its per-model ollama runner subprocesses, with PSS accounting where available
  • Loaded models — name, VRAM/RAM split, context length, processor type, TTL countdown
  • Container health — status indicator (●/✗/○), uptime, CPU & memory with progress bars
  • Multi-vendor GPU monitoring — NVIDIA via nvidia-smi and AMD via sysfs, side by side on the same host; utilization, VRAM/GTT, temperature, power draw
  • AMD without ROCm — telemetry comes from /sys/class/drm/card*/device, so a bare amdgpu driver is enough; rocm-smi is only a fallback
  • Jetson / Tegra / NVIDIA Spark — automatic fallback to unified memory via /proc/meminfo
  • Non-blocking UI — all I/O (docker, nvidia-smi, HTTP) runs in a background collector thread; the interface stays responsive at 100 ms even when the API hangs, and stale data is flagged
  • Interactiveq to quit, +/- to adjust refresh interval, o to toggle raw ollama ps
  • Scriptable--json one-shot mode for cron, Prometheus textfile collectors, or Ansible facts (exit code 1 on unhealthy)
  • API-only mode--no-docker for monitoring remote Ollama instances without local docker calls
  • cgroup-aware CPU bar — normalizes against the container's --cpus/quota limit, not the host core count
  • Docker and bare-metal — auto-detects the source: a Docker container, a systemd ollama.service, or a manual ollama serve; monitors process CPU/MEM via /proc (Linux, no root) or ps/sysctl (macOS)
  • Docker-aware — talks to both the Ollama API and docker exec ollama ps
  • Respects $OLLAMA_HOST — works with remote Ollama instances out of the box
  • Zero external dependencies — only Python stdlib (curses, urllib, json, subprocess)

Quick Start

One-liner (no install)

curl -fsSL https://github.com/Quaerendir/mtop/releases/latest/download/mtop.py -o mtop.py
chmod +x mtop.py
./mtop.py

pip install

pip install ollama-mtop
mtop

From source

git clone https://github.com/Quaerendir/mtop.git
cd mtop
pip install -e .
mtop

Run directly from a clone (no install)

git clone https://github.com/Quaerendir/mtop.git
cd mtop
PYTHONPATH=src python -m mtop

Usage

mtop [-c CONTAINER] [-i INTERVAL] [-u URL] [-m MODE] [--no-gpu] [--no-docker] [--json] [-V] [-h]

Options:
  -c, --container NAME   Docker container name (default: ollama)
  -m, --mode MODE        Data source: auto|docker|local|api (default: auto)
                         local = bare-metal `ollama serve` (systemd/proc/ps)
                         api   = models only, no host resource stats
  -i, --interval SECS    Refresh interval in seconds (default: 1.0)
  -u, --api-url URL      Ollama API base URL (default: $OLLAMA_HOST or http://localhost:11434)
                         Scheme-less values (gpu-rig:11434) are accepted, like Ollama itself
      --no-gpu           Disable GPU monitoring section
      --no-runners       Hide the RUNNERS section (effective inference config)
      --no-docker        API-only mode: skip all docker calls (remote instances)
      --json             Print one snapshot as JSON and exit (exit 1 on unhealthy)
  -V, --version          Show version
  -h, --help             Show help

Examples

# Monitor a custom container name
mtop -c my-ollama

# Slower refresh for remote/metered connections
mtop -i 5

# Bare-metal Ollama (systemd service or `ollama serve` in a terminal)
mtop --mode local

# Let mtop figure it out (docker? systemd? manual? — it probes in that order)
mtop

# Monitor a remote Ollama instance — API only, no local docker/GPU noise
mtop -u 192.168.1.100:11434 --mode api

# One-shot health/state snapshot for scripting
mtop --json | jq '.models[].name'

# Using OLLAMA_HOST environment variable
export OLLAMA_HOST=http://gpu-rig:11434
mtop

Interactive Keys

Key Action
q / ESC Quit
+ Decrease refresh interval (faster)
- Increase refresh interval (slower)
o Toggle raw ollama ps section
r Toggle the RUNNERS section

Display Layout

─── mtop v0.2.0 — Ollama Model Monitor ───
host: gpu-rig     container: ● ollama     up: 3d 14h     2026-03-11 15:42:01
────────────────────────────────────────────────────────────────────────────────
CONTAINER RESOURCES
   CPU  [████░░░░░░░░░░░░░░░░░░░░░░░░░░]  12.3%
   MEM  [██████████████░░░░░░░░░░░░░░░░]  45.2%     14.2GiB / 31.4GiB
GPU
   [0] NVIDIA GeForce RTX 4090  42°C
     UTIL [████████░░░░░░░░░░░░░░░░░]  32.0%
     VRAM [██████████████████░░░░░░░]  72.4%     17382 / 24000 MiB
LOADED MODELS
   MODEL                                VRAM        RAM         CTX       PROCESSOR       EXPIRES
   ──────────────────────────────────────────────────────────────────────────────────────────────
   qwen2.5-coder:32b-instruct-q8_0     18.42 G     0.00 G      32768     GPU             4m 32s left
OLLAMA PS (raw)
   NAME                                SIZE       PROCESSOR    UNTIL
   qwen2.5-coder:32b-instruct-q8_0     19.8 GB    100% GPU     4 minutes from now

Supported Platforms

Platform GPU Monitoring Notes
Linux x86_64 + NVIDIA ✅ Full nvidia-smi on host or in container
NVIDIA Jetson / Orin ✅ Unified memory Falls back to /proc/meminfo
NVIDIA GB10 Spark ✅ Unified memory Tegra-based, same fallback
Linux + AMD (amdgpu) ✅ Full sysfs — no ROCm install required
AMD APU (780M, Strix) ✅ Unified memory GTT pool, not the tiny VRAM carve-out
Linux without GPU ✅ (no GPU section) Use --no-gpu to hide the section
Bare-metal Ollama (systemd) ✅ process stats --mode local; CPU/MEM from /proc, no root needed
Manual ollama serve ✅ process stats auto-detected via /proc cmdline scan
macOS ⚠️ Partial --mode local monitors the process via ps/sysctl; GPU (Metal) not yet supported
WSL2 ⚠️ Partial Works if Docker + nvidia-container-toolkit configured

Requirements

  • Python 3.10+ (uses match-era type hints like list[str], X | Y)
  • Docker (for container monitoring)
  • Ollama running in a Docker container (or accessible via API)
  • nvidia-smi (optional, for GPU stats)

Roadmap

  • Record terminal sessions with asciinema for README gif
  • AMD GPU support (sysfs first, rocm-smi fallback)
  • Apple Silicon GPU stats (via powermetrics)
  • Model pull progress tracking
  • Multiple container / multi-host support
  • Configurable layout (raw ollama ps toggle; more sections to follow)
  • Model actions — unload on keypress (keep_alive: 0), extend TTL
  • Sparkline history for CPU/GPU utilization (braille chars, stdlib deque)
  • systemd/bare-metal Ollama support (process stats via /proc, no Docker required)
  • Log panel (tail Ollama container logs)
  • Effective inference config per runner (context, flash attention, KV dtype)
  • Request rate / tokens-per-second from Ollama API

Contributing

PRs welcome. Keep it stdlib-only — the zero-dependency constraint is a feature, not a limitation.

git clone https://github.com/Quaerendir/mtop.git
cd mtop
pip install -e .
# hack on src/mtop/*.py
mtop

# regenerate the single-file artifact shipped with releases
python tools/bundle.py       # -> dist/mtop.py

dist/mtop.py is generated — never edit it by hand.

License

MIT — see LICENSE.

Acknowledgements

Built as a collaboration between a human homelab geek and Claude (Anthropic) during a late-night infrastructure session. The original bash prototype migrated to Python/curses because fighting tput and jq in a loop was getting old.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ollama_mtop-0.4.1.tar.gz (37.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ollama_mtop-0.4.1-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file ollama_mtop-0.4.1.tar.gz.

File metadata

  • Download URL: ollama_mtop-0.4.1.tar.gz
  • Upload date:
  • Size: 37.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for ollama_mtop-0.4.1.tar.gz
Algorithm Hash digest
SHA256 343a18c6035df931c360c5894d58f1c96d0d11f64761704ec0af59046672c7b4
MD5 4b506861198844287e50f69945cb7c49
BLAKE2b-256 0112f20c47c13b92382878c0d026ac0d54716fac7027b7eda94eb33d6cb476aa

See more details on using hashes here.

File details

Details for the file ollama_mtop-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: ollama_mtop-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for ollama_mtop-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 991d10bb85e37e7be909995f83f5167818cd9bbbb1d98127485f7fe0e709e4a6
MD5 60d5eb0d12243727a227db6acb9e414f
BLAKE2b-256 969cc86b2972718702b851f287a12445fb9303cb7a68b96d809445f94465b6c2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 files

0.3.0

2 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page