mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 16:04:50 +03:00
feat(nodes): add fleet monitoring and implement the Penpot layout (#7342)
Expose sampled CPU topology, absolute RAM, TCP/UDP counts, load averages and network throughput through the existing heartbeat and descendant contracts, preserving measured zero versus unavailable values. Add an explicit nullable telemetry migration and freshness/availability checks.
Provide read-only All nodes and Master rows with deduplicated host/client totals, grouped SQL aggregation and reporting coverage. Preserve known descendants during parent outages and prefer the freshest valid observation of shared GUIDs. Keep the ordinary heartbeat broadcast free of fleet-wide totals.
Implement the approved compact Penpot-inspired Nodes layout, responsive stacked details, status diagnostics and existing remote actions. Preserve cached rows, search and controls on overview refresh failures. By maintainer decision, hide both system rows when no remote nodes are registered.
Final review of 44ed457985: no outstanding HIGH or MEDIUM findings. CI and Docs CI passed (13 jobs; 2342 frontend tests in 269 files), including Go/race and mixed-version node E2E. Feature-specific PostgreSQL regression execution was not independently verified in the selected CI logs. See https://github.com/MHSanaei/3x-ui/pull/7342#issuecomment-7363599190.
Closes #7335
Closes #7336
Closes #7337
This commit is contained in:
@@ -922,10 +922,11 @@ type Node struct {
|
||||
MemPct float64 `json:"memPct" example:"45.1"`
|
||||
UptimeSecs uint64 `json:"uptimeSecs" example:"86400"`
|
||||
// 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"`
|
||||
UnavailableMetrics []string `json:"unavailableMetrics,omitempty" gorm:"serializer:json;column:unavailable_metrics"`
|
||||
Telemetry *NodeTelemetry `json:"telemetry,omitempty" gorm:"serializer:json;type:text"`
|
||||
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"
|
||||
@@ -980,8 +981,11 @@ type NodeSummary struct {
|
||||
PanelVersion string `json:"panelVersion"`
|
||||
XrayVersion string `json:"xrayVersion"`
|
||||
// XrayState/XrayError forwarded so masters can surface xray failure on transitive sub-nodes too.
|
||||
XrayState string `json:"xrayState"`
|
||||
XrayError string `json:"xrayError,omitempty"`
|
||||
XrayState string `json:"xrayState"`
|
||||
XrayError string `json:"xrayError,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Telemetry *NodeTelemetry `json:"telemetry,omitempty"`
|
||||
}
|
||||
|
||||
type ClientReverse struct {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package model
|
||||
|
||||
// NodeTelemetry describes one host sample. Nil metrics were not measured.
|
||||
type NodeTelemetry struct {
|
||||
SampledAt int64 `json:"sampledAt" example:"1700000000000"`
|
||||
SampleAgeMillis *int64 `json:"sampleAgeMillis,omitempty" example:"125"`
|
||||
ResourceScope string `json:"resourceScope,omitempty" example:"container"`
|
||||
CpuPct *float64 `json:"cpuPct,omitempty" example:"12.5"`
|
||||
PhysicalCores *int `json:"physicalCores,omitempty" example:"4"`
|
||||
LogicalCores *int `json:"logicalCores,omitempty" example:"8"`
|
||||
MemUsedBytes *uint64 `json:"memUsedBytes,omitempty" example:"2147483648"`
|
||||
MemTotalBytes *uint64 `json:"memTotalBytes,omitempty" example:"4294967296"`
|
||||
MemAvailableBytes *uint64 `json:"memAvailableBytes,omitempty" example:"1073741824"`
|
||||
TCPCount *int `json:"tcpCount,omitempty" example:"75"`
|
||||
UDPCount *int `json:"udpCount,omitempty" example:"12"`
|
||||
Load1 *float64 `json:"load1,omitempty" example:"0.25"`
|
||||
Load5 *float64 `json:"load5,omitempty" example:"0.18"`
|
||||
Load15 *float64 `json:"load15,omitempty" example:"0.12"`
|
||||
UptimeSecs *uint64 `json:"uptimeSecs,omitempty" example:"3600"`
|
||||
NetUp *uint64 `json:"netUp,omitempty" example:"1024"`
|
||||
NetDown *uint64 `json:"netDown,omitempty" example:"2048"`
|
||||
}
|
||||
Reference in New Issue
Block a user