package health import ( "path/filepath" "runtime" ) type Snapshot struct { UptimeSeconds int64 CPUUsagePercent float64 MemoryUsagePercent float64 StorageTotalBytes uint64 StorageFreeBytes uint64 LibraryFileCount int ActiveStreams int CurrentBytesPerSec int64 ScanStatus string Errors []string } func MemoryUsagePercent() float64 { var m runtime.MemStats runtime.ReadMemStats(&m) if m.Sys == 0 { return 0 } return float64(m.Alloc) / float64(m.Sys) * 100 } func DiskUsage(paths []string) (total, free uint64) { seen := map[string]bool{} for _, p := range paths { if p == "" { continue } key := filepath.Clean(p) if seen[key] { continue } seen[key] = true t, f := diskStat(p) total += t free += f } return total, free }