system

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package system operates with system metrics data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPU added in v0.6.1

type CPU struct {
	List []CPUData
}

CPU type has a list of CPUData.

type CPUData added in v0.6.1

type CPUData struct {
	N string
	// Pcts without "%"
	UserPct uint
	SysPct  uint
	WaitPct uint
	IdlePct uint
}

CPUData type is a struct of cpu metrics.

type CPUUpdater added in v0.6.1

type CPUUpdater interface {
	UpdateCPU(sigar.Cpu, int64)
}

type DF added in v0.6.1

type DF struct {
	List []DFData
}

DF type has a list of DFData.

type DFData added in v0.6.1

type DFData struct {
	DevName string
	DirName string

	// inodes
	Inodes  string
	Iused   string
	Ifree   string
	IusePct uint

	// bytes
	Total  string
	Used   string
	Avail  string
	UsePct uint
}

DFData type is a struct of disk metrics.

type ExtraMetricCPU

type ExtraMetricCPU struct {
	Wait    *GaugePercent
	Irq     *GaugePercent
	SoftIrq *GaugePercent
	Stolen  *GaugePercent
}

func (*ExtraMetricCPU) UpdateCPU

func (emc *ExtraMetricCPU) UpdateCPU(sigarCpu sigar.Cpu, totalDelta int64)

type ExtraMetricRAM

type ExtraMetricRAM struct {
	Used     metrics.Gauge
	Buffered metrics.Gauge
	Cached   metrics.Gauge
}

func (*ExtraMetricRAM) UpdateRAM

func (emr *ExtraMetricRAM) UpdateRAM(got sigar.Mem, extra1, extra2 uint64)

type GaugeDiff added in v0.6.1

type GaugeDiff struct {
	Delta    metrics.Gauge // Delta as the primary metric.
	Absolute metrics.Gauge // Absolute keeps the absolute value, not exported as it's registered in private registry.
	Previous metrics.Gauge // Previous keeps the previous absolute value, not exported as it's registered in private registry.
	Mutex    sync.Mutex
}

GaugeDiff holds two Gauge metrics: the first is the exported one. Caveat: The exported metric value is 0 initially, not "nan", until updated.

func NewGaugeDiff added in v0.6.1

func NewGaugeDiff(name string, r metrics.Registry) *GaugeDiff

func (*GaugeDiff) DeltaValue added in v0.6.1

func (gd *GaugeDiff) DeltaValue() uint64

func (*GaugeDiff) UpdateAbsolute added in v0.6.1

func (gd *GaugeDiff) UpdateAbsolute(absolute int64) int64

func (*GaugeDiff) Values added in v0.6.1

func (gd *GaugeDiff) Values() (int64, int64)

type GaugePercent added in v0.6.1

type GaugePercent struct {
	Percent  metrics.GaugeFloat64 // Percent as the primary metric.
	Previous metrics.Gauge
	Mutex    sync.Mutex
}

func NewGaugePercent added in v0.6.1

func NewGaugePercent(name string, r metrics.Registry) *GaugePercent

func (*GaugePercent) SnapshotValueUint added in v0.6.1

func (gp *GaugePercent) SnapshotValueUint() uint

func (*GaugePercent) UpdatePercent added in v0.6.1

func (gp *GaugePercent) UpdatePercent(totalDelta int64, uabsolute uint64)

type IF added in v0.6.1

type IF struct {
	List []IFData
}

IF type has a list of IFData.

type IFData added in v0.6.1

type IFData struct {
	Name string
	IP   string

	BytesIn          string
	BytesOut         string
	DeltaBitsIn      string
	DeltaBitsOut     string
	DeltaBytesOutNum uint64

	DropsIn       string
	DropsOut      string `json:",omitempty"`
	DeltaDropsIn  string
	DeltaDropsOut string `json:",omitempty"`

	ErrorsIn       string
	ErrorsOut      string
	DeltaErrorsIn  string
	DeltaErrorsOut string

	PacketsIn       string
	PacketsOut      string
	DeltaPacketsIn  string
	DeltaPacketsOut string
}

IFData type is a struct of interface metrics.

type IfAddress added in v0.6.1

type IfAddress interface {
	GetName() string
	GetIP() string
	BytesIn() uint
	BytesOut() uint
	DropsIn() uint
	DropsOut() uint
	ErrorsIn() uint
	ErrorsOut() uint
	PacketsIn() uint
	PacketsOut() uint
}

type MEM added in v0.6.1

type MEM struct {
	List []Memory
}

MEM type has a list of Memory.

type Memory added in v0.6.1

type Memory struct {
	Kind   string
	Total  string
	Used   string
	Free   string
	UsePct uint
}

Memory type is a struct of memory metrics.

type MetricCPU added in v0.6.1

type MetricCPU struct {
	// derive from one of (go-)metric types, otherwise it won't be registered
	metrics.Healthcheck
	N       string // The "cpu-N"
	UserPct *GaugePercent
	NicePct *GaugePercent
	SysPct  *GaugePercent
	WaitPct *GaugePercent
	IdlePct *GaugePercent
	Total   *GaugeDiff
	Extra   CPUUpdater
}

func ExtraNewMetricCPU added in v0.6.1

func ExtraNewMetricCPU(r metrics.Registry, name string, extra CPUUpdater) *MetricCPU

func NewMetricCPU

func NewMetricCPU(r metrics.Registry, name string) *MetricCPU

func (*MetricCPU) Update added in v0.6.1

func (mc *MetricCPU) Update(scpu sigar.Cpu)

type MetricDF added in v0.6.1

type MetricDF struct {
	// derive from one of (go-)metric types, otherwise it won't be registered
	metrics.Healthcheck
	DevName  MetricString
	Free     metrics.GaugeFloat64
	Reserved metrics.GaugeFloat64
	Total    metrics.Gauge
	Used     metrics.GaugeFloat64
	Avail    metrics.Gauge
	UsePct   metrics.GaugeFloat64
	Inodes   metrics.Gauge
	Iused    metrics.Gauge
	Ifree    metrics.Gauge
	IusePct  metrics.GaugeFloat64
	DirName  MetricString
}

func (*MetricDF) Update added in v0.6.1

func (md *MetricDF) Update(fs sigar.FileSystem, usage sigar.FileSystemUsage)

Update reads usage and fs and updates the corresponding fields in DF.

type MetricIF added in v0.6.1

type MetricIF struct {
	NewGD func(string) *GaugeDiff // internal
	// derive from one of (go-)metric types, otherwise it won't be registered
	metrics.Healthcheck
	Name       string
	IP         MetricString
	BytesIn    *GaugeDiff
	BytesOut   *GaugeDiff
	DropsIn    *GaugeDiff
	DropsOut   *GaugeDiff
	ErrorsIn   *GaugeDiff
	ErrorsOut  *GaugeDiff
	PacketsIn  *GaugeDiff
	PacketsOut *GaugeDiff
}

MetricIF set of interface metrics.

func NewMetricIF added in v0.6.1

func NewMetricIF(reg metrics.Registry, name string) *MetricIF

func (*MetricIF) Update added in v0.6.1

func (mi *MetricIF) Update(ifaddr IfAddress)

Update reads ifaddr and updates the corresponding fields in MetricIF.

type MetricLoad added in v0.6.1

type MetricLoad struct {
	Short metrics.GaugeFloat64
	Mid   metrics.GaugeFloat64
	Long  metrics.GaugeFloat64
}

func NewMetricLoad added in v0.6.1

func NewMetricLoad(r metrics.Registry) *MetricLoad

type MetricRAM added in v0.6.1

type MetricRAM struct {
	Free  metrics.Gauge
	Total metrics.Gauge
	Extra RAMUpdater
}

func ExtraNewMetricRAM added in v0.6.1

func ExtraNewMetricRAM(r metrics.Registry, extra RAMUpdater) *MetricRAM

func NewMetricRAM

func NewMetricRAM(r metrics.Registry) *MetricRAM

func (*MetricRAM) Update added in v0.6.1

func (mr *MetricRAM) Update(got sigar.Mem, extra1, extra2 uint64)

func (*MetricRAM) UsedValue added in v0.6.1

func (mr *MetricRAM) UsedValue() uint64

type MetricString added in v0.6.1

type MetricString interface {
	Snapshot() MetricString
	Value() string
	Update(string)
}

type MetricStringSnapshot added in v0.6.1

type MetricStringSnapshot string

func (MetricStringSnapshot) Snapshot added in v0.6.1

func (mss MetricStringSnapshot) Snapshot() MetricString

func (MetricStringSnapshot) Update added in v0.6.1

func (MetricStringSnapshot) Update(string)

func (MetricStringSnapshot) Value added in v0.6.1

func (mss MetricStringSnapshot) Value() string

type MetricSwap added in v0.6.1

type MetricSwap struct {
	Free metrics.Gauge
	Used metrics.Gauge
}

func NewMetricSwap added in v0.6.1

func NewMetricSwap(r metrics.Registry) MetricSwap

func (*MetricSwap) TotalValue added in v0.6.1

func (ms *MetricSwap) TotalValue() uint64

func (*MetricSwap) Update added in v0.6.1

func (ms *MetricSwap) Update(got sigar.Swap)

type PSData added in v0.6.1

type PSData struct {
	PID      uint
	UID      uint
	Priority int
	Nice     int
	Time     string
	Name     string
	User     string
	Size     string // with units
	Resident string // with units
}

PSData type is a public (for index context, json marshaling) account of a process.

type PSInfo added in v0.6.1

type PSInfo struct {
	PID      uint
	Priority int
	Nice     int
	Time     uint64
	Name     string
	UID      uint
	Size     uint64
	Resident uint64
}

PSInfo type is an internal account of a process.

type RAM added in v0.6.1

type RAM struct {
	Memory
	Extra1 uint64 // linux:buffered // darwin:wired
	Extra2 uint64 // linux:cached   // darwin:active
}

type RAMUpdater added in v0.6.1

type RAMUpdater interface {
	UpdateRAM(sigar.Mem, uint64, uint64)
}

type StandardMetricString added in v0.6.1

type StandardMetricString struct {
	Mutex sync.Mutex
	// contains filtered or unexported fields
}

func (*StandardMetricString) Snapshot added in v0.6.1

func (sms *StandardMetricString) Snapshot() MetricString

func (*StandardMetricString) Update added in v0.6.1

func (sms *StandardMetricString) Update(new string)

func (*StandardMetricString) Value added in v0.6.1

func (sms *StandardMetricString) Value() string

Jump to

Keyboard shortcuts

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