Documentation ¶
Overview ¶
Package interfacestat implements metrics Collection related to network interfaces
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InterfaceStat ¶
type InterfaceStat struct { Interfaces map[string]*PerInterfaceStat // contains filtered or unexported fields }
InterfaceStat represents statistics about all interfaces
func New ¶
func New(m *metrics.MetricContext, Step time.Duration) *InterfaceStat
New starts Collection of statistics for all interfaces on the host refreshing per every Step. Metric Collection is performed in a goroutine.
func (*InterfaceStat) ByUsage ¶
func (s *InterfaceStat) ByUsage() []*PerInterfaceStat
ByUsage returns an slice of *PerInterfaceStat entries sorted by usage
func (*InterfaceStat) Collect ¶
func (s *InterfaceStat) Collect()
Collect reads /proc/net/dev to gather statistics for interfaces. Collect reads /sysfs to figure out interface capabilities. Collect is generally called directly when the package is initialized.
type PerInterfaceStat ¶
type PerInterfaceStat struct { Metrics *PerInterfaceStatMetrics Name string // contains filtered or unexported fields }
PerInterfaceStat represents statistics Collected for a single interface
func NewPerInterfaceStat ¶
func NewPerInterfaceStat(m *metrics.MetricContext, dev string) *PerInterfaceStat
NewPerInterfaceStat initializes and registers metrics with metriccontext for an interface
func (*PerInterfaceStat) RXBandwidth ¶
func (s *PerInterfaceStat) RXBandwidth() float64
RXBandwidth returns amount of bits/s received
func (*PerInterfaceStat) RXBandwidthUsage ¶
func (s *PerInterfaceStat) RXBandwidthUsage() float64
RXBandwidthUsage returns received bandwidth usage as percentage relative to Speed TODO: Add detection for full/half duplex. Full duplex is assumed currently.
func (*PerInterfaceStat) Speed ¶
func (s *PerInterfaceStat) Speed() float64
Speed returns interface speed of interface in bits/sec
func (*PerInterfaceStat) TXBandwidth ¶
func (s *PerInterfaceStat) TXBandwidth() float64
TXBandwidth returns amount of bits/s transmitted
func (*PerInterfaceStat) TXBandwidthUsage ¶
func (s *PerInterfaceStat) TXBandwidthUsage() float64
TXBandwidthUsage returns transmitted bandwidth usage as percentage relative to Speed TODO: Add detection for full/half duplex. Full duplex is assumed currently.
type PerInterfaceStatMetrics ¶
type PerInterfaceStatMetrics struct { RXbytes *metrics.Counter RXpackets *metrics.Counter RXerrs *metrics.Counter RXdrop *metrics.Counter RXfifo *metrics.Counter RXframe *metrics.Counter RXcompressed *metrics.Counter RXmulticast *metrics.Counter TXbytes *metrics.Counter TXpackets *metrics.Counter TXerrs *metrics.Counter TXdrop *metrics.Counter TXfifo *metrics.Counter TXframe *metrics.Counter TXcompressed *metrics.Counter TXmulticast *metrics.Counter Speed *metrics.Gauge }
PerInterfaceStatMetrics represents statistics automatically initialized per interface