mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-25 15:25:01 +03:00
fix(monitoring): read LXC CPU, swap and uptime from the container (#6920)
In an LXC container with LXCFS the Overview showed the container's RAM beside the host's swap, the host's CPU topology and a CPU percentage from the host's view. Swap and uptime now come from LXCFS's virtualised files and CPU from the container's cgroup v2 counter, normalised by the visible vCPUs and any quota; container CPU and swap history is kept apart from the earlier host samples. A value the reader cannot measure (the first CPU sample, or a layout it cannot verify such as cgroup v1) is reported as unavailable instead of 0: the dashboard, the node list, node CPU history and the Telegram and Discord uptime show a dash, and nodes keep the flags in a new unavailable_metrics column.
This commit is contained in:
@@ -864,9 +864,11 @@ type Node struct {
|
||||
CpuPct float64 `json:"cpuPct" example:"23.5"`
|
||||
MemPct float64 `json:"memPct" example:"45.1"`
|
||||
UptimeSecs uint64 `json:"uptimeSecs" example:"86400"`
|
||||
NetUp uint64 `json:"netUp" gorm:"column:net_up" example:"1048576"`
|
||||
NetDown uint64 `json:"netDown" gorm:"column:net_down" example:"2097152"`
|
||||
LastError string `json:"lastError"`
|
||||
// Nil on legacy rows and responses: zero remains a valid measured value.
|
||||
UnavailableMetrics []string `json:"unavailableMetrics,omitempty" gorm:"serializer:json;column:unavailable_metrics"`
|
||||
NetUp uint64 `json:"netUp" gorm:"column:net_up" example:"1048576"`
|
||||
NetDown uint64 `json:"netDown" gorm:"column:net_down" example:"2097152"`
|
||||
LastError string `json:"lastError"`
|
||||
|
||||
// XrayState and XrayError are captured from the remote node's /panel/api/server/status
|
||||
// during heartbeats. They let the central panel distinguish "panel API reachable"
|
||||
|
||||
Reference in New Issue
Block a user