ssh_crawler/main.go
insanity 1552f4eaba ing
2017-10-23 14:31:04 +09:00

69 lines
1.0 KiB
Go

package main
import (
"fmt"
"git.loafle.net/overflow/ssh_crawler/crawler"
)
func main() {
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
cpu, err := cr.CPUStat()
if err != nil {
fmt.Printf("err : %s\n", err)
}
fmt.Printf("CPU: %s\n", cpu)
//MEM
mem, err := cr.MEMStat()
if err != nil {
fmt.Printf("err : %s\n", err)
}
fmt.Printf("MEM: %s\n", mem)
//Disk IO
diskio, err := cr.DiskIOStat()
if err != nil {
fmt.Printf("err : %s\n", err)
}
fmt.Printf("DiskIO: %s\n", diskio)
//Disk Free
diskFree, err := cr.DiskFreeStat()
if err != nil {
fmt.Printf("err : %s\n", err)
}
fmt.Printf("DiskFree: %s\n", diskFree)
//Load Avg.
load, err := cr.LoadAvgStat()
if err != nil {
fmt.Printf("err : %s\n", err)
}
fmt.Printf("Load: %s\n", load)
//Network
net, err := cr.NetworkStat()
if err != nil {
fmt.Printf("err : %s\n", err)
}
fmt.Printf("Net: %s\n", net)
}