diff --git a/Plugin/unraid/include/watchdog.php b/Plugin/unraid/include/watchdog.php index bbafb05..724fe3b 100644 --- a/Plugin/unraid/include/watchdog.php +++ b/Plugin/unraid/include/watchdog.php @@ -222,7 +222,20 @@ function vv_wd_local_system(): array { $loadRaw = @file_get_contents('/proc/loadavg') ?: '0'; $daemonOk = (trim(shell_exec('docker info >/dev/null 2>&1; echo $?') ?: '1') === '0'); $oomCount = (int)trim(@file_get_contents(STATE_DIR . '/system_watchdog_oom.db') ?: '0'); - $cores = (int)($sys['cpu_cores'] ?: (int)(trim(shell_exec('nproc 2>/dev/null') ?: '1'))); + // nproc first, and cpu_cores only as a fallback — the reverse of what this used to do. + // + // The page draws its load bar and colours against this number multiplied by the same + // RW_LOAD_* multipliers resource_watchdog.sh uses, and that script computes its thresholds + // from `nproc` (resource_watchdog.sh:194). cpu_cores is the API's physical core count: 16 here + // against 32 threads. Preferring it made the page turn amber at load 32 and red at 48 while + // the watchdog did not reach soft pressure until 64 and medium until 96 — the page reporting + // a crisis about a subsystem that considered the machine idle, which is the one thing a page + // whose entire job is showing what the watchdogs think must not do. + // + // Whether load should be judged against threads or cores is a real argument; it is not this + // file's argument to have. The number here has to be the number the actor used, or the page + // is describing a different machine. + $cores = (int)(trim(shell_exec('nproc 2>/dev/null') ?: '') ?: ($sys['cpu_cores'] ?: 1)); return [ 'mem_total' => (int)($mem['total_kb'] * 1024), 'mem_avail' => (int)($mem['free_kb'] * 1024),