mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 02:09:28 +08:00
agent binary - show correct cores in lxc
This commit is contained in:
@@ -211,8 +211,13 @@ func (a *Agent) getSystemStats() (system.Info, system.Stats) {
|
|||||||
systemInfo.Cores = cores
|
systemInfo.Cores = cores
|
||||||
}
|
}
|
||||||
if threads, err := cpu.Counts(true); err == nil {
|
if threads, err := cpu.Counts(true); err == nil {
|
||||||
|
if threads > 0 && threads < systemInfo.Cores {
|
||||||
|
// in lxc logical cores reflects container limits, so use that as cores if lower
|
||||||
|
systemInfo.Cores = threads
|
||||||
|
} else {
|
||||||
systemInfo.Threads = threads
|
systemInfo.Threads = threads
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return systemInfo, systemStats
|
return systemInfo, systemStats
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,7 @@ type Info struct {
|
|||||||
Hostname string `json:"h"`
|
Hostname string `json:"h"`
|
||||||
KernelVersion string `json:"k,omitempty"`
|
KernelVersion string `json:"k,omitempty"`
|
||||||
Cores int `json:"c"`
|
Cores int `json:"c"`
|
||||||
Threads int `json:"t"`
|
Threads int `json:"t,omitempty"`
|
||||||
CpuModel string `json:"m"`
|
CpuModel string `json:"m"`
|
||||||
// Os string `json:"o"`
|
// Os string `json:"o"`
|
||||||
Uptime uint64 `json:"u"`
|
Uptime uint64 `json:"u"`
|
||||||
|
@@ -220,7 +220,11 @@ export default function SystemDetail({ name }: { name: string }) {
|
|||||||
},
|
},
|
||||||
{ value: uptime, Icon: ClockArrowUp, label: 'Uptime' },
|
{ value: uptime, Icon: ClockArrowUp, label: 'Uptime' },
|
||||||
{ value: system.info.k, Icon: TuxIcon, label: 'Kernel' },
|
{ value: system.info.k, Icon: TuxIcon, label: 'Kernel' },
|
||||||
{ value: `${system.info.m} (${system.info.c}c/${system.info.t}t)`, Icon: CpuIcon },
|
{
|
||||||
|
value: `${system.info.m} (${system.info.c}c${system.info.t ? `/${system.info.t}t` : ''})`,
|
||||||
|
Icon: CpuIcon,
|
||||||
|
hide: !system.info.m,
|
||||||
|
},
|
||||||
] as {
|
] as {
|
||||||
value: string | number | undefined
|
value: string | number | undefined
|
||||||
label?: string
|
label?: string
|
||||||
|
2
beszel/site/src/types.d.ts
vendored
2
beszel/site/src/types.d.ts
vendored
@@ -17,7 +17,7 @@ export interface SystemInfo {
|
|||||||
/** cpu percent */
|
/** cpu percent */
|
||||||
cpu: number
|
cpu: number
|
||||||
/** cpu threads */
|
/** cpu threads */
|
||||||
t: number
|
t?: number
|
||||||
/** cpu cores */
|
/** cpu cores */
|
||||||
c: number
|
c: number
|
||||||
/** cpu model */
|
/** cpu model */
|
||||||
|
Reference in New Issue
Block a user