diff --git a/component/session/server.go b/component/session/server.go index dbdbceb..e2ca461 100644 --- a/component/session/server.go +++ b/component/session/server.go @@ -98,15 +98,16 @@ table, th, td { // Statistics table _, _ = fmt.Fprintf(w, "

Statistics (%d)

", runtime.NumGoroutine()) _, _ = fmt.Fprintf(w, "") - _, _ = fmt.Fprintf(w, "\n") + _, _ = fmt.Fprintf(w, "\n") trafficUp := atomic.LoadInt64(&s.trafficUp) trafficDown := atomic.LoadInt64(&s.trafficDown) - _, _ = fmt.Fprintf(w, "\n", - date(time.Now()), - uptime(), + _, _ = fmt.Fprintf(w, "\n", + platform(), cpu(), mem(), disk(), + date(time.Now()), + uptime(), byteCountSI(trafficUp+trafficDown), byteCountSI(trafficUp), byteCountSI(trafficDown), diff --git a/component/session/utils.go b/component/session/utils.go index 53dcef8..7611797 100644 --- a/component/session/utils.go +++ b/component/session/utils.go @@ -7,6 +7,7 @@ import ( C "github.com/shirou/gopsutil/cpu" D "github.com/shirou/gopsutil/disk" + H "github.com/shirou/gopsutil/host" M "github.com/shirou/gopsutil/mem" ) @@ -32,6 +33,14 @@ func disk() string { return fmt.Sprintf("%.1f%%", d.UsedPercent) } +func platform() string { + h, err := H.Info() + if err != nil { + return "N/A" + } + return fmt.Sprintf("%s-%s", h.Platform, h.PlatformVersion) +} + func mem() string { m, err := M.VirtualMemory() if err != nil {
Last Refresh TimeUptimeCPUMemDiskTotalUploadDownload
PlatformCPUMemDisk
Last Refresh TimeUptimeTotalUploadDownload
%v%v%v%v%v%v%v%v
%v%v%v%v%v%v%v%v%v