feat: add disk telemetry and clean navigation
This commit is contained in:
@@ -10,6 +10,7 @@ import json
|
||||
import mimetypes
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import socket
|
||||
import sqlite3
|
||||
import subprocess
|
||||
@@ -576,6 +577,24 @@ def _gpu_snapshot() -> dict[str, Any]:
|
||||
return {"detected": nvidia_present, "telemetry_available": False, "count": 0, "utilization_percent": None, "gpus": []}
|
||||
|
||||
|
||||
def _disk_snapshot() -> dict[str, Any]:
|
||||
"""Return usage for the filesystem visible to the dashboard process."""
|
||||
path = "/"
|
||||
try:
|
||||
usage = shutil.disk_usage(path)
|
||||
except OSError:
|
||||
return {"path": path, "available": False, "total_bytes": 0, "used_bytes": 0, "free_bytes": 0, "used_percent": None}
|
||||
return {
|
||||
"path": path,
|
||||
"available": True,
|
||||
"total_bytes": usage.total,
|
||||
"used_bytes": usage.used,
|
||||
"free_bytes": usage.free,
|
||||
"used_percent": round(usage.used * 100 / usage.total, 1) if usage.total else None,
|
||||
"scope": "Filesystem visible to the dashboard process",
|
||||
}
|
||||
|
||||
|
||||
def _runtime_snapshot() -> dict[str, Any]:
|
||||
mem = _read_meminfo()
|
||||
total = mem.get("MemTotal", 0)
|
||||
@@ -633,6 +652,7 @@ def _runtime_snapshot() -> dict[str, Any]:
|
||||
"ollama_model_bytes": ollama_model_bytes,
|
||||
"ollama_model_vram_bytes": ollama_model_vram_bytes,
|
||||
"ollama_target_model_bytes": ollama_target_model_bytes,
|
||||
"disk": _disk_snapshot(),
|
||||
"cpu": cpu,
|
||||
"gpu": gpu,
|
||||
}
|
||||
@@ -1898,6 +1918,7 @@ def status() -> dict[str, Any]:
|
||||
),
|
||||
},
|
||||
"connections": connection_rows,
|
||||
"disk": _disk_snapshot(),
|
||||
"models": local,
|
||||
"popular": popular,
|
||||
"popular_filter": {
|
||||
|
||||
Reference in New Issue
Block a user