Exemple #1
0
func printSystemInfo() {
	fmt.Println(collector.KernelHostname())
	fmt.Println(collector.KernelMaxFiles())
	fmt.Println(collector.KernelMaxProc())
	fmt.Println(collector.LoadAvg())
	fmt.Println(collector.CpuSnapShoot())
	mountPoints, _ := collector.ListMountPoint()
	fmt.Println(mountPoints)

	for idx := range mountPoints {
		fmt.Println(collector.BuildDeviceUsage(mountPoints[idx]))
	}

	netIfs, err := collector.NetIfs()
	fmt.Println("NetIfs.err: ", err)
	for _, netIf := range netIfs {
		fmt.Println(netIf)
	}

	fmt.Println(collector.MemInfo())

	fmt.Println("listening ports: ", collector.ListenPorts())

	fmt.Println(collector.SystemUptime())

	diskStats, _ := collector.ListDiskStats()
	for _, ds := range diskStats {
		fmt.Println(ds)
	}
}
Exemple #2
0
func UpdateIfStat() error {
	netIfs, err := collector.NetIfs()
	if err != nil {
		return err
	}

	for i := 0; i < len(netIfs); i++ {
		iface := netIfs[i].Iface
		NetIfList[iface] = [2]*collector.NetIf{netIfs[i], NetIfList[iface][0]}
	}
	return nil
}