mirror of
https://github.com/henrygd/beszel.git
synced 2026-09-16 04:54:36 +00:00
fix(agent): don't read host CPU and memory totals from a Docker VM (#2272)
refreshSystemDetails() takes NCPU and MemTotal from the Docker daemon's /info response. That only describes this machine when the daemon shares its kernel. On macOS and Windows Docker runs inside a Linux VM, so the system details header shows the VM's memory as the host total, and the VM's CPU count clamps both cores and threads through the lxc branch below it. Only consult Docker's host info on platforms where the daemon runs natively. Everything else already falls back to gopsutil, which reads this host.
This commit is contained in:
+5
-1
@@ -32,7 +32,11 @@ func (a *Agent) refreshSystemDetails() {
|
||||
|
||||
if a.dockerManager != nil {
|
||||
a.systemDetails.Podman = a.dockerManager.IsPodman()
|
||||
hostInfo, _ = a.dockerManager.GetHostInfo()
|
||||
// Docker's host info describes the machine its daemon runs on. On macOS and
|
||||
// Windows that is a Linux VM, so its CPU and memory totals are not this host's.
|
||||
if runtime.GOOS != "darwin" && runtime.GOOS != "windows" {
|
||||
hostInfo, _ = a.dockerManager.GetHostInfo()
|
||||
}
|
||||
}
|
||||
|
||||
a.systemDetails.Hostname, _ = os.Hostname()
|
||||
|
||||
Reference in New Issue
Block a user