Source File
net_dev.go
Belonging Package
github.com/prometheus/procfs
package procfs
import (
)
type NetDevLine struct {
Name string `json:"name"` // The name of the interface.
RxBytes uint64 `json:"rx_bytes"` // Cumulative count of bytes received.
RxPackets uint64 `json:"rx_packets"` // Cumulative count of packets received.
RxErrors uint64 `json:"rx_errors"` // Cumulative count of receive errors encountered.
RxDropped uint64 `json:"rx_dropped"` // Cumulative count of packets dropped while receiving.
RxFIFO uint64 `json:"rx_fifo"` // Cumulative count of FIFO buffer errors.
RxFrame uint64 `json:"rx_frame"` // Cumulative count of packet framing errors.
RxCompressed uint64 `json:"rx_compressed"` // Cumulative count of compressed packets received by the device driver.
RxMulticast uint64 `json:"rx_multicast"` // Cumulative count of multicast frames received by the device driver.
TxBytes uint64 `json:"tx_bytes"` // Cumulative count of bytes transmitted.
TxPackets uint64 `json:"tx_packets"` // Cumulative count of packets transmitted.
TxErrors uint64 `json:"tx_errors"` // Cumulative count of transmit errors encountered.
TxDropped uint64 `json:"tx_dropped"` // Cumulative count of packets dropped while transmitting.
TxFIFO uint64 `json:"tx_fifo"` // Cumulative count of FIFO buffer errors.
TxCollisions uint64 `json:"tx_collisions"` // Cumulative count of collisions detected on the interface.
TxCarrier uint64 `json:"tx_carrier"` // Cumulative count of carrier losses detected by the device driver.
TxCompressed uint64 `json:"tx_compressed"` // Cumulative count of compressed packets transmitted by the device driver.
}
type NetDev map[string]NetDevLine
.RxBytes, = strconv.ParseUint([0], 10, 64)
if != nil {
return nil,
}
.RxPackets, = strconv.ParseUint([1], 10, 64)
if != nil {
return nil,
}
.RxErrors, = strconv.ParseUint([2], 10, 64)
if != nil {
return nil,
}
.RxDropped, = strconv.ParseUint([3], 10, 64)
if != nil {
return nil,
}
.RxFIFO, = strconv.ParseUint([4], 10, 64)
if != nil {
return nil,
}
.RxFrame, = strconv.ParseUint([5], 10, 64)
if != nil {
return nil,
}
.RxCompressed, = strconv.ParseUint([6], 10, 64)
if != nil {
return nil,
}
.RxMulticast, = strconv.ParseUint([7], 10, 64)
if != nil {
return nil,
}
.TxBytes, = strconv.ParseUint([8], 10, 64)
if != nil {
return nil,
}
.TxPackets, = strconv.ParseUint([9], 10, 64)
if != nil {
return nil,
}
.TxErrors, = strconv.ParseUint([10], 10, 64)
if != nil {
return nil,
}
.TxDropped, = strconv.ParseUint([11], 10, 64)
if != nil {
return nil,
}
.TxFIFO, = strconv.ParseUint([12], 10, 64)
if != nil {
return nil,
}
.TxCollisions, = strconv.ParseUint([13], 10, 64)
if != nil {
return nil,
}
.TxCarrier, = strconv.ParseUint([14], 10, 64)
if != nil {
return nil,
}
.TxCompressed, = strconv.ParseUint([15], 10, 64)
if != nil {
return nil,
}
return , nil
}
func ( NetDev) () NetDevLine {
:= NetDevLine{}
:= make([]string, 0, len())
for , := range {
= append(, .Name)
.RxBytes += .RxBytes
.RxPackets += .RxPackets
.RxErrors += .RxErrors
.RxDropped += .RxDropped
.RxFIFO += .RxFIFO
.RxFrame += .RxFrame
.RxCompressed += .RxCompressed
.RxMulticast += .RxMulticast
.TxBytes += .TxBytes
.TxPackets += .TxPackets
.TxErrors += .TxErrors
.TxDropped += .TxDropped
.TxFIFO += .TxFIFO
.TxCollisions += .TxCollisions
.TxCarrier += .TxCarrier
.TxCompressed += .TxCompressed
}
sort.Strings()
.Name = strings.Join(, ", ")
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |