ssh_crawler/main.go
insanity 3ef6659f46 ing
2017-10-23 18:08:19 +09:00

64 lines
1.0 KiB
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)
//Process
psCh := make(chan interface{})
cr.ProcessStat(psCh)
fmt.Println(<-psCh)
close(psCh)
}