forked from UlricQin/falcon
/
main.go
41 lines (32 loc) · 897 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
"github.com/ulricqin/falcon/collector"
)
func main() {
fmt.Println("listening ports: ", collector.ListenPorts())
}
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)
}
}