netstat

package
v0.0.0-...-51b3ee1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2016 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IfStat

type IfStat struct {
	Name string

	RxBytes      uint64
	RxPackets    uint64
	RxErrs       uint64
	RxDrop       uint64
	RxFIFO       uint64
	RxFrame      uint64
	RxCompressed uint64
	RxMulticast  uint64

	TxBytes      uint64
	TxPackets    uint64
	TxErrs       uint64
	TxDrop       uint64
	TxFIFO       uint64
	TxColls      uint64
	TxCarrier    uint64
	TxCompressed uint64
}

IfStat represents statistics about a network interface.

func ReadIfStats

func ReadIfStats() ([]IfStat, error)

ReadIfStats is shorthand for DefaultIfStatReader.ReadIfStats.

type IfStatCollector

type IfStatCollector struct {
	// contains filtered or unexported fields
}

IfStatCollector computes metrics for network interfaces.

func NewIfStatCollector

func NewIfStatCollector(reader InterfaceStatReader, except *regexp.Regexp) (*IfStatCollector, error)

NewIfStatCollector returns brand new interface stats collector.

func (*IfStatCollector) Collect

func (c *IfStatCollector) Collect() ([]metric.Event, error)

Collect collects stats and creates events for network interfaces.

type IfStatReader

type IfStatReader struct {
	// contains filtered or unexported fields
}

IfStatReader reads statistics for network interfaces.

func NewIfStatReader

func NewIfStatReader(path string) *IfStatReader

NewIfStatReader creates IfStatReader that reads from the specified path. It expects well defined format and may cause panics if it is not present.

func (*IfStatReader) ReadStats

func (r *IfStatReader) ReadStats() ([]IfStat, error)

type InterfaceStatReader

type InterfaceStatReader interface {
	ReadStats() ([]IfStat, error)
}

InterfaceStatReader should read statistics for all available network interfaces.

var DefaultIfStatReader InterfaceStatReader = NewIfStatReader("/proc/net/dev")

DefaultIfStatReader is the default implementation of InterfaceStatReader. It reads interface statistics from /proc/net/dev.

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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