diff --git a/component/session/server.go b/component/session/server.go index 98398e9..6ccf6fd 100644 --- a/component/session/server.go +++ b/component/session/server.go @@ -98,14 +98,15 @@ 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", + _, _ = fmt.Fprintf(w, "\n", date(time.Now()), uptime(), cpu(), mem(), + disk(), byteCountSI(trafficUp+trafficDown), byteCountSI(trafficUp), byteCountSI(trafficDown), diff --git a/component/session/utils.go b/component/session/utils.go index 661e8e7..53dcef8 100644 --- a/component/session/utils.go +++ b/component/session/utils.go @@ -6,6 +6,7 @@ import ( "time" C "github.com/shirou/gopsutil/cpu" + D "github.com/shirou/gopsutil/disk" M "github.com/shirou/gopsutil/mem" ) @@ -23,6 +24,14 @@ func cpu() string { return fmt.Sprintf("%.1f%%", c[0]) } +func disk() string { + d, err := D.Usage("/") + if err != nil { + return "N/A" + } + return fmt.Sprintf("%.1f%%", d.UsedPercent) +} + func mem() string { m, err := M.VirtualMemory() if err != nil {
Last Refresh TimeUptimeCPUMEMTotalUploadDownload
Last Refresh TimeUptimeCPUMEMDISKTotalUploadDownload
%v%v%v%v%v%v%v
%v%v%v%v%v%v%v%v