Skip to content

Disk Monitor

Sia edited this page May 31, 2026 · 2 revisions

Disk Usage Monitor

Background poller that measures the workspace filesystem every 10 minutes and surfaces results in two places:

  • Dashboard card ("디스크 사용량")
  • Email + webhook alert on transitioning past the warn threshold

Behavior

DiskMonitor reads Files.getFileStore(workspace.root):

Field Source
totalBytes store.totalSpace
usableBytes store.usableSpace
usedBytes total - usable (clamped ≥ 0)
usedPercent (used / total) * 100, integer, clamped 0-100

Polled every pollIntervalMinutes (default 10). The latest snapshot is cached so the dashboard card renders immediately without re-walking the filesystem.

Threshold alerts

  • Threshold lives in email.diskUsageWarnPercent (default 85). Same config is reused for both email and webhook channels — splitting them is on the roadmap if anyone needs different thresholds per channel.
  • Alert fires on transition (cross from below the threshold to at-or- above). Once active, no further alerts until usage drops back below the threshold and rises again.
  • 30-minute cooldown prevents repeated alerts during a flapping measurement.
  • Both EmailNotifier.diskUsageWarn(usedPercent, freeGb) and WebhookNotifier.diskUsageWarn(...) are called via the Notifiers facade.

Dashboard card

Color-coded progress bar:

  • 0 % – 84 %: green
  • 85 % – 94 %: yellow ("warning")
  • 95 % – 100 %: red ("critical")

The card also links to Build Cache since clearing Gradle caches is the fastest way to recover space inside the container.

What's measured

Whatever filesystem holds workspace.root (typically /workspace inside the container, mounted from ${VIBE_DATA_ROOT}/workspace/ on the host).

Note this is the filesystem's total / free, not just the workspace directory's size. If you bind-mount the workspace on the same disk as your host's /, the dashboard percentage reflects the entire host disk — which is often what you actually want for an operations alert.

If you want a directory-level size (only the workspace), use the host:

du -sh vibe-coder-data/workspace

Configuration

email:
  diskUsageWarnPercent: 85          # reused for both email and webhook

To change the poll cadence or alert threshold for specific use cases, override the warnThresholdPercentProvider and pollIntervalMinutes constructor parameters when wiring DiskMonitor in ServerMain.kt.

Roadmap

  • Per-subdirectory size breakdown (workspace / postgres / dev-tools / claude) on the dashboard — currently you have to du -sh on the host.
  • Threshold split: separate webhook.diskUsageWarnPercent so you can page Slack at 80 % and email at 90 %.
  • History graph (last 7 / 30 days) — currently only the latest snapshot is kept in memory.

Clone this wiki locally