예제 #1
0
파일: main.go 프로젝트: healthly/falcon
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)
	}
}
예제 #2
0
func UpdateCpuStat() error {
	if CpuNum == 0 {
		CpuNum = collector.CpuNum()
	}

	snap, err := collector.CpuSnapShoot()
	if err != nil {
		return err
	}

	length := global.MaxCpustatHistory
	for i := length - 1; i > 0; i-- {
		CpuSnapshootList[i] = CpuSnapshootList[i-1]
	}

	CpuSnapshootList[0] = snap
	return nil
}
예제 #3
0
파일: main.go 프로젝트: sdgdsffdsfff/falcon
func main2() {
	fmt.Println(collector.KernelAllocateFiles())
	fmt.Println(collector.CpuSnapShoot())
}