Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: add disk usage monitoring to system health dashboard
Adam Eivy43e380b6dbbf
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 8f6eab80ac..2355e5d019 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -14,6 +14,7 @@- Inline note editor with Cmd+S save, backlinks panel, and frontmatter properties view- Full-text search with context snippets and relevance ranking- Link graph endpoint for vault-wide wikilink visualization+- **Disk usage monitoring** on dashboard — system health endpoint now reports root filesystem disk usage (total/used/free/percent) with warning at 85% and critical alert at 95%; SystemHealthWidget displays a new Disk card with progress bar alongside Memory, CPU, Processes, and Apps## Fixeddiff --git a/client/src/components/SystemHealthWidget.jsx b/client/src/components/SystemHealthWidget.jsxindex d546b14536..bcf6bb297e 100644--- a/client/src/components/SystemHealthWidget.jsx+++ b/client/src/components/SystemHealthWidget.jsx@@ -5,6 +5,7 @@ import {Server,Cpu,HardDrive,+ Database,ChevronRight,AlertTriangle,CheckCircle,@@ -121,7 +122,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget() {)}{/* Stats Grid */}- <div className="grid grid-cols-2 sm:grid-cols-4 gap-3">+ <div className="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3">{/* Memory Usage */}<div className="bg-port-bg/50 rounded-lg p-3"><div className="flex items-center gap-2 mb-1">@@ -205,6 +206,28 @@ const SystemHealthWidget = memo(function SystemHealthWidget() {)}</div></div>++ {/* Disk Usage */}+ {system.disk && (+ <div className="bg-port-bg/50 rounded-lg p-3">+ <div className="flex items-center gap-2 mb-1">+ <Database size={14} className="text-cyan-400" />+ <span className="text-xs text-gray-500">Disk</span>+ </div>+ <div className={`text-lg sm:text-xl font-bold ${getUsageColor(system.disk.usagePercent)}`}>+ {system.disk.usagePercent}%+ </div>+ <div className="text-xs text-gray-500">+ {system.disk.usedFormatted} / {system.disk.totalFormatted}+ </div>+ <div className="mt-2 h-1.5 bg-port-border rounded-full overflow-hidden">+ <div+ className={`h-full rounded-full transition-all ${getBarColor(system.disk.usagePercent)}`}+ style={{ width: `${system.disk.usagePercent}%` }}+ />+ </div>+ </div>+ )}</div>{/* CoS Status (if running) */}diff --git a/server/routes/systemHealth.js b/server/routes/systemHealth.jsindex e26801b1dc..1e6900bcd3 100644--- a/server/routes/systemHealth.js+++ b/server/routes/systemHealth.js@@ -1,5 +1,6 @@import { Router } from 'express';import os from 'os';+import { statfs } from 'fs/promises';import { listProcesses } from '../services/pm2.js';import * as apps from '../services/apps.js';import * as cos from '../services/cos.js';@@ -32,13 +33,14 @@ router.get('/health/details', async (req, res) => {const startTime = Date.now();// Gather data in parallel- const [pm2Processes, allApps, cosStatus, self, dbHealth, version] = await Promise.all([+ const [pm2Processes, allApps, cosStatus, self, dbHealth, version, diskStats] = await Promise.all([listProcesses().catch(() => []),apps.getAllApps({ includeArchived: false }).catch(() => []),cos.getStatus().catch(() => null),getSelf().catch(() => null),checkHealth().catch(() => ({ connected: false, hasSchema: false, error: 'Health check failed' })),- getCurrentVersion().catch(() => null)+ getCurrentVersion().catch(() => null),+ statfs('/').catch(() => null)]);// System metrics@@ -50,6 +52,21 @@ router.get('/health/details', async (req, res) => {const cpuCount = os.cpus().length;const cpuUsagePercent = Math.round((cpuLoad / cpuCount) * 100);+ // Disk usage (root filesystem)+ let disk = null;+ if (diskStats) {+ const totalDisk = diskStats.blocks * diskStats.bsize;+ const freeDisk = diskStats.bavail * diskStats.bsize;+ const usedDisk = totalDisk - (diskStats.bfree * diskStats.bsize);+ const diskUsagePercent = Math.round((usedDisk / totalDisk) * 100);+ disk = {+ total: totalDisk,+ used: usedDisk,+ free: freeDisk,+ usagePercent: diskUsagePercent+ };+ }+// Process status summary from PM2const processStats = {total: pm2Processes.length,@@ -86,6 +103,16 @@ router.get('/health/details', async (req, res) => {warnings.push({ type: 'cpu', message: 'CPU load high' });}+ if (disk) {+ if (disk.usagePercent > 95) {+ overallHealth = 'critical';+ warnings.push({ type: 'disk', message: 'Disk usage above 95%' });+ } else if (disk.usagePercent > 85) {+ if (overallHealth !== 'critical') overallHealth = 'warning';+ warnings.push({ type: 'disk', message: 'Disk usage above 85%' });+ }+ }+if (processStats.errored > 0) {overallHealth = 'critical';warnings.push({ type: 'process', message: `${processStats.errored} process(es) errored` });@@ -159,7 +186,16 @@ router.get('/health/details', async (req, res) => {cores: cpuCount,loadAvg1m: cpuLoad,usagePercent: cpuUsagePercent- }+ },+ disk: disk ? {+ total: disk.total,+ used: disk.used,+ free: disk.free,+ usagePercent: disk.usagePercent,+ totalFormatted: formatBytes(disk.total),+ usedFormatted: formatBytes(disk.used),+ freeFormatted: formatBytes(disk.free)+ } : null},processes: processStats,apps: appStats,