87 lines
1.7 KiB
Go
87 lines
1.7 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.usage.total을 선택했을 때의 수집항목들 (..출력 항목도 포함시켜서 계산결과 리턴해야하나?)
|
|
cpukeys := []string{
|
|
"cpu.usage.sum",
|
|
"cpu.usage.user",
|
|
"cpu.usage.system",
|
|
"cpu.usage.nice",
|
|
"cpu.usage.idle",
|
|
"cpu.usage.iowait",
|
|
"cpu.usage.irq",
|
|
"cpu.usage.softirq",
|
|
"cpu.usage.steal",
|
|
"cpu.usage.guest",
|
|
"cpu.usage.guestNice",
|
|
}
|
|
cpuCh := make(chan interface{})
|
|
cr.CPUStat(cpuCh, cpukeys)
|
|
fmt.Println(<-cpuCh)
|
|
|
|
//Memory
|
|
memkeys := []string {
|
|
"mem.usage.total",
|
|
"mem.usage.free",
|
|
"mem.usage.available",
|
|
"mem.usage.buffers",
|
|
"mem.usage.cached",
|
|
"mem.swap.usage.total",
|
|
"mem.swap.usage.free",
|
|
"mem.swap.usage.cached",
|
|
}
|
|
memCh := make(chan interface{})
|
|
cr.MemStat(memCh, memkeys)
|
|
fmt.Println(<-memCh)
|
|
|
|
//memCh := make(chan interface{})
|
|
//cr.MemStat(memCh, keys)
|
|
//fmt.Println(<-memCh)
|
|
|
|
////Memory
|
|
//memCh := make(chan interface{})
|
|
//cr.MemStat(memCh)
|
|
//fmt.Println(<-memCh)
|
|
//
|
|
////Disk IO
|
|
//diskioCh := make(chan interface{})
|
|
//cr.DiskIOStat(diskioCh)
|
|
//fmt.Println(<-diskioCh)
|
|
//
|
|
////Disk Free
|
|
//diskFreeCh := make(chan interface{})
|
|
//cr.DiskFreeStat(diskFreeCh)
|
|
//fmt.Println(<-diskFreeCh)
|
|
//
|
|
////Network
|
|
//netCh := make(chan interface{})
|
|
//cr.NetworkStat(netCh)
|
|
//fmt.Println(<-netCh)
|
|
//
|
|
////Load Avg.
|
|
//loadCh := make(chan interface{})
|
|
//cr.LoadAvgStat(loadCh)
|
|
//fmt.Println(<-loadCh)
|
|
//
|
|
////Process
|
|
//psCh := make(chan interface{})
|
|
//cr.ProcessStat(psCh)
|
|
//fmt.Println(<-psCh)
|
|
}
|