项目作者: codeskyblue

项目描述 :
linux系统的监控
高级语言: Go
项目地址: git://github.com/codeskyblue/monitor.git
创建时间: 2013-05-28T06:09:58Z
项目社区:https://github.com/codeskyblue/monitor

开源协议:

下载


Monitor of Linux Process

Build Status

Used in Linux system.

Parse /proc info and get Cpu, Mem, Hostname, Pids (and each state)

Not maintained now. Please refer to the new project https://github.com/cloudfoundry/gosigar

Download

  1. go get github.com/shxsun/monitor

Example (see more in example dir)

  1. package main
  2. import "fmt"
  3. import "time"
  4. import "github.com/shxsun/monitor"
  5. func main(){
  6. // monitor.Interval = time.Second * 2 // default 1s, (refresh gap)
  7. monitor.GoRefresh()
  8. for {
  9. fmt.Printf("Cpu usage: %.1f%%\n", monitor.Cpu() * 100)
  10. time.Sleep(5e8) // 0.5s
  11. }
  12. }