os/

directory
v0.0.0-...-4714720 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2015 License: Apache-2.0, Apache-2.0

README

os

os is a collection of libraries for gathering operating system metrics.

Installation
  1. Get go
  2. go get -v -u github.com/square/inspect/os/[module]
Documentation

http://godoc.org/github.com/square/inspect/os

Example API use
package main

import (
	"fmt"
	"time"

	"github.com/square/inspect/metrics"
	"github.com/square/inspect/os/cpustat"
)

func main() {
	// Initialize a metric context
	m := metrics.NewMetricContext("system")

	// Collect CPU metrics every 1 (Step) second
	cstat := cpustat.New(m, time.Millisecond*1000)

	// Allow two samples to be collected. Since most metrics are counters.
	time.Sleep(time.Millisecond * 1000 * 3)
	fmt.Println("CPU usage (%) : ", (cstat.Usage()/cstat.Total())*100)
}

Implemented libraries:

  • CPU usage
    • Platforms: Linux, MacOSX
    • For linux, per cgroup information is included
  • Memory usage
    • Platforms: Linux, MacOSX
    • For linux, per cgroup information is included
  • Filesystem usage
    • Platforms: Linux
  • Interface usage
    • Platforms: Linux
  • IO subsystem usage
    • Platforms: Linux
  • TCP
    • Platforms: Linux
  • Per Process metrics
    • Platforms: Linux, MacOSX
    • On Linux
      • CPU
      • Memory
      • IO (requires root)
    • On MacOSX (requires root)
      • CPU
      • Memory
  • Load average * Platforms: Linux
Development
  • Designed to run as a long-lived process with minimal memory footprint - Re-use objects where possible.
  • Please run golint.
TODO
  • TESTS
  • PerProcessStat on darwin doesn't include optimizations done for Linux.
  • Add io metrics per process (need root priviliges)

Directories

Path Synopsis
Package cpustat implements metrics collection related to CPU usage
Package cpustat implements metrics collection related to CPU usage
Package diskstat implements metrics collection related to disk IO usage
Package diskstat implements metrics collection related to disk IO usage
Package fsstat implements metrics collection related to filesystem usage
Package fsstat implements metrics collection related to filesystem usage
Package interfacestat implements metrics Collection related to network interfaces
Package interfacestat implements metrics Collection related to network interfaces
Package loadstat implements metrics collection related to loadavg
Package loadstat implements metrics collection related to loadavg
Package memstat implements metrics collection related to Memory usage
Package memstat implements metrics collection related to Memory usage
Package pidstat implements metrics collection per-PID like memory/cpu
Package pidstat implements metrics collection per-PID like memory/cpu
Package tcpstat implements metrics collection related to TCP
Package tcpstat implements metrics collection related to TCP

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL