This is a creation in Article, where the information may have evolved or changed.
Psutil
It's okay. GitHub, found that python on the collection system information of the famous module Psutil already have go version, can't wait to download and play.
The address on GitHub ishttps://github.com/shirou/gopsutil
Show some basic information about this machine
Package Mainimport ("FMT" "Github.com/shirou/gopsutil/cpu" "Github.com/shirou/gopsutil/disk" "Github.com/shir Ou/gopsutil/host "" Github.com/shirou/gopsutil/mem ") func main () {V, _: = Mem. Virtualmemory () C, _: = CPU. CPUInfo () d, _: = Disk. Diskusage ("/") n, _: = host. Hostinfo () fmt. Printf ("Mem:%v GB Free:%v MB usage:%f%%\n", v.total/4/1024/1024/1024/1024, v.free/4/1024/1024/1024, v.us edpercent) If Len (c) > 1 {for _, Sub_cpu: = Range C {modelname: = sub_cpu. ModelName cores: = Sub_cpu. Cores FMT. Printf ("CPU:%v%v cores \ n", modelname, Cores)}} else {sub_cpu: = c[0] Modeln Ame: = sub_cpu. ModelName cores: = Sub_cpu. Cores FMT. Printf ("CPU:%v%v cores \ n", modelname, Cores)} FMT. Printf ("HD:%v GB Free:%v GB usage:%f%%\n", d.total/1024/1024/1024, d.free/1024/1024/1024, d.usedpercent ) FMT. Printf (" OS:%v%v \ n ", N.os, N.platformversion) fmt. Printf ("Hostname:%v \ n", N.hostname)}
$ statusmem:8 GB free:0 MB Usage:99.999886%cpu:intel (R) Core (TM) i5-4278u CPU @ 2.60GHz 2 coreshd : free:39 GB usage:64.653732%hostname:xxx-pro.localos_version:14.1.0