mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-23 19:37:13 +00:00
feat(dashboard): more System History metrics, persistence & localized labels
- Sample swap %, TCP/UDP connection counts and disk-usage % on the host ticker - System History: Swap overlaid on the RAM tab, plus new Connections and Disk Usage tabs - Persist the host time-series across restarts: gob snapshot beside the DB, written on a timer and at shutdown, restored on boot - Live-refresh the open chart (2s for short ranges, 10s for longer) - Localize CPU/RAM/Swap and the new tab/chart titles across all 13 languages and route legend series names through i18n
This commit is contained in:
@@ -565,12 +565,22 @@ func (s *ServerService) AppendStatusSample(t time.Time, status *Status) {
|
||||
if status.Mem.Total > 0 {
|
||||
systemMetrics.append("mem", t, float64(status.Mem.Current)*100.0/float64(status.Mem.Total))
|
||||
}
|
||||
if status.Swap.Total > 0 {
|
||||
systemMetrics.append("swap", t, float64(status.Swap.Current)*100.0/float64(status.Swap.Total))
|
||||
} else {
|
||||
systemMetrics.append("swap", t, 0)
|
||||
}
|
||||
systemMetrics.append("netUp", t, float64(status.NetIO.Up))
|
||||
systemMetrics.append("netDown", t, float64(status.NetIO.Down))
|
||||
systemMetrics.append("diskRead", t, float64(status.DiskIO.Read))
|
||||
systemMetrics.append("diskWrite", t, float64(status.DiskIO.Write))
|
||||
if status.Disk.Total > 0 {
|
||||
systemMetrics.append("diskUsage", t, float64(status.Disk.Current)*100.0/float64(status.Disk.Total))
|
||||
}
|
||||
systemMetrics.append("pktUp", t, float64(status.NetIO.PktUp))
|
||||
systemMetrics.append("pktDown", t, float64(status.NetIO.PktDown))
|
||||
systemMetrics.append("tcpCount", t, float64(status.TcpCount))
|
||||
systemMetrics.append("udpCount", t, float64(status.UdpCount))
|
||||
online := 0
|
||||
if p != nil && p.IsRunning() {
|
||||
online = len(p.GetOnlineClients())
|
||||
|
||||
Reference in New Issue
Block a user