ssh_crawler/main.go
insanity 2ee7fa5853 ing
2017-10-23 15:59:38 +09:00

65 lines
976 B
Go

package main
import (
"fmt"
"git.loafle.net/overflow/ssh_crawler/crawler"
"runtime"
)
func main() {
runtime.GOMAXPROCS(4)
const ip = "192.168.1.15"
const port = "22"
const user = "administrator"
const pw = "!@#$qwer1234"
cr, err := crawler.New(ip, port, user, pw)
if err != nil {
fmt.Println(err)
}
//CPU
cpuCh := make(chan interface{})
cr.CPUStat(cpuCh)
fmt.Println(<-cpuCh)
close(cpuCh)
//Memory
memCh := make(chan interface{})
cr.MemStat(memCh)
fmt.Println(<-memCh)
close(memCh)
//Disk IO
diskioCh := make(chan interface{})
cr.DiskIOStat(diskioCh)
fmt.Println(<-diskioCh)
close(diskioCh)
//Disk Free
diskFreeCh := make(chan interface{})
cr.DiskFreeStat(diskFreeCh)
fmt.Println(<-diskFreeCh)
close(diskFreeCh)
//Network
netCh := make(chan interface{})
cr.NetworkStat(netCh)
fmt.Println(<-netCh)
close(netCh)
//Load Avg.
loadCh := make(chan interface{})
cr.LoadAvgStat(loadCh)
fmt.Println(<-loadCh)
close(loadCh)
}