colab-monitor
by khailhust
README.md
# Google Colab Resource Monitor
Real-time telemetry dashboard, resource guardrail watchdog, remote VM file/process manager, and **Antigravity MCP App plugin** for Google Colab runtimes (works with both browser-opened notebooks and `colab new` CLI sessions).
[](LICENSE)
---
## Screenshots
| Dark Mode (2×2 Live Telemetry & Guardrails) | Light Mode (EN / VN & Theme Switcher) |
| :---: | :---: |
|  |  |
| Running VM Processes (SSH & Ephemeral Kernel) | Remote VM File Explorer (Upload, Tail & Download) |
| :---: | :---: |
|  |  |
---
## Features
- **Live 2×2 Resource Charts:** System RAM, GPU VRAM, **GPU Compute Util %** (with runtime proxy ping latency in ms), and Disk — rendered with **Monotone Cubic Spline**, configurable zero-phase **EMA smoothing**, **Y-axis auto-zoom**, `2 min → 1 hr / All` time windows, and synchronized hover crosshair tooltips.
- **Light / Dark Theme & Bilingual UI (`EN` / `VN`):** Instant theme switching (`Dark` / `Light` or IDE host theme sync in Antigravity) and full `EN` / `VN` localization across headers, charts, modals, and persisted **Event Log** entries.
- **Compute Units Guardrails:**
- **CU Burn & Runway:** Tracks remaining Compute Units, hourly burn rate, session CU spend, estimated runtime remaining, and daily CU history (`data/usage_history.json`).
- **Auto-Stop on Idle:** Automatically unassigns runtimes if all Jupyter kernels stay `idle` and `GPU Compute Util < 5%` for 15 / 30 / 60 minutes.
- **Budget Cap & Browser Alerts:** Configurable per-session CU cap (with optional auto-stop) plus sound/notification alerts on notebook completion (`busy → idle`), RAM >= 90%, and VRAM >= 95%.
- **Pinned Live Tail Log:** Pin any `.log`, `.txt`, `.py`, or script file from `/content` directly under its session card to stream tail updates every 3 seconds (`50` / `120` / `250` lines, pause/resume).
- **VM Process Monitor (`⚙️ Processes`):** Lists top GPU (`nvidia-smi`) and Linux (`ps`) processes over SSH WebSocket (`/colab/ssh`) with automatic Ephemeral Kernel fallback (`ColabRuntime`), protected core-process guards, and `SIGTERM` / `SIGKILL (-9)` termination.
- **Remote File Explorer (`📁 Files`):** Browse `/content` and mounted Drive folders, preview text/log files, download files, **drag-and-drop upload** (up to 50 MB), create folders, and delete non-protected paths.
- **Three Ways to Run:**
1. **Standalone Web Dashboard** (`http://127.0.0.1:8765`)
2. **Windows System Tray App** (`start-tray.bat`) with color-coded status indicator, CU/VRAM hover tooltip, and Balloon alerts
3. **Antigravity IDE Plugin (`colab-monitor`)** exposing interactive **MCP App** side-pane / sidebar views alongside 8 agent-callable MCP tools
---
## Prerequisites
- Authenticated [google-colab-cli](https://github.com/googlecolab/colab-cli) (`uv tool install google-colab-cli` and logged in via `colab`)
- Python 3.11+ (ships inside `uv` tool environment on Windows by default)
- **Optional (for building the Antigravity MCP App plugin bundle):**
- [Node.js](https://nodejs.org/) 20+ (`npm` installs `@modelcontextprotocol/ext-apps` and `esbuild` into `%LOCALAPPDATA%\colab-monitor-app-build`)
- [`uv`](https://docs.astral.sh/uv/) on `PATH`
---
## Quick Start (Windows)
### 1. Standalone Web Dashboard
- **Launch with console & auto-open browser:** Double-click [`start-monitor.bat`](start-monitor.bat) or run:
```powershell
.\start-monitor.ps1 -Port 8765 -Interval 3.0
```
- **Run server directly:**
```powershell
python server.py --host 127.0.0.1 --port 8765 --interval 3.0
```
Then open `http://127.0.0.1:8765`.
### 2. Windows System Tray App
Double-click [`start-tray.bat`](start-tray.bat) to start both the background telemetry server and a native Windows Forms `NotifyIcon` tray icon with status colors, live CU/VRAM tooltip, right-click menu, and Windows Balloon notifications.
### 3. Antigravity IDE Plugin (`colab-monitor`)
Build and install the self-contained MCP App plugin into `%USERPROFILE%\.gemini\config\plugins\colab-monitor`:
```powershell
.\build-plugin.ps1
```
This creates an isolated `.venv` inside the plugin directory, compiles [`plugin-src/mcp-bridge.js`](plugin-src/mcp-bridge.js) + [`static/index.html`](static/index.html) into a single CSP-clean HTML bundle (`ui/app.html`), and registers:
- **UI Entrypoints (`ui://colab-monitor/app.html`):** Open **Colab Monitor** from the **`+`** menu in the Antigravity side pane or **Plugins** in the left sidebar.
- **MCP Tools (`colab-monitor_monitor`):**
- `open_monitor` — Open/refresh the interactive MCP App panel
- `get_colab_status` — Query CU balance, burn rate, active sessions, RAM/VRAM/GPU Util/Disk
- `list_vm_files` / `tail_vm_log` — Browse VM directories or tail log files
- `scan_vm_processes` — Inspect GPU and Linux processes on an active runtime
- `manage_guardrails` — View/update Auto-Stop Idle, Budget Cap, interval, or CU baseline
- `start_colab_session` / `stop_colab_session` — Provision or terminate Colab runtimes
---
## Project Structure
```text
colab-monitor/
├── collector.py # Shared Colab telemetry poller, watchdog & VM controller
├── server.py # Standalone local HTTP dashboard server
├── mcp_server.py # Antigravity MCP server & MCP App UI backend
├── static/
│ └── index.html # Self-contained dashboard UI (Light/Dark, EN/VN, Web & MCP adapter)
├── docs/
│ └── images/ # Showcase screenshots
├── plugin-src/ # Antigravity plugin manifest, MCP config, skill, logo & bridge source
│ ├── mcp-bridge.js
│ ├── plugin.json
│ ├── mcp_config.json
│ ├── assets/logo.svg
│ └── skills/colab-monitor/SKILL.md
├── build-plugin.ps1 # Builds ui/app.html & installs plugin to ~/.gemini/config/plugins/colab-monitor
├── tray-monitor.ps1 # Windows Forms system tray monitor
├── start-tray.bat # Hidden launcher for tray-monitor.ps1
├── start-monitor.ps1 # Web server launcher script
├── start-monitor.bat # Batch entrypoint for start-monitor.ps1
├── requirements.txt
├── .gitignore
├── LICENSE
└── README.md
```
---
## Privacy & Repository Hygiene
Runtime logs and local settings stored under `data/` (`config.json`, `usage_history.json`, `metrics_history.json`, `events_history.json`, `ui_prefs.json`), `.venv/`, `__pycache__/`, and build artifacts are excluded via [`.gitignore`](.gitignore) so personal session IDs and CU history are not committed.
---
## License & Copyright
Copyright (c) 2026 **khai.le (khailhust)**.
Released under the [MIT License](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues