示例#1
0
func main() {
	netIOCounterSt, err := net.NetIOCounters(true)

	if err != nil {
		log.Panicln(err)
	}

	for _, netIOSt := range netIOCounterSt {
		log.Println(netIOSt)
	}

	netProtoCounters, err := net.NetProtoCounters(nil)
	if err != nil {
		log.Panicln(err)
	}

	for _, netProtoSt := range netProtoCounters {
		log.Println(netProtoSt)
	}

	netConnectionStat, err := net.NetConnections("all")
	if err != nil {
		log.Panicln(err)
	}

	for _, netConnSt := range netConnectionStat {
		log.Println(netConnSt)
	}

}
示例#2
0
文件: ps.go 项目: zooplus/telegraf
func (s *systemPS) NetProto() ([]net.NetProtoCountersStat, error) {
	return net.NetProtoCounters(nil)
}