2019-11-09 03:55:37 +08:00
|
|
|
package ethtool
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"net"
|
2020-01-03 08:15:48 +08:00
|
|
|
|
|
|
|
|
"github.com/influxdata/telegraf"
|
2019-11-09 03:55:37 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Command interface {
|
|
|
|
|
Init() error
|
|
|
|
|
DriverName(intf string) (string, error)
|
|
|
|
|
Interfaces() ([]net.Interface, error)
|
|
|
|
|
Stats(intf string) (map[string]uint64, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Ethtool struct {
|
|
|
|
|
// This is the list of interface names to include
|
|
|
|
|
InterfaceInclude []string `toml:"interface_include"`
|
|
|
|
|
|
|
|
|
|
// This is the list of interface names to ignore
|
|
|
|
|
InterfaceExclude []string `toml:"interface_exclude"`
|
|
|
|
|
|
2021-10-20 04:44:36 +08:00
|
|
|
// Normalization on the key names
|
|
|
|
|
NormalizeKeys []string `toml:"normalize_keys"`
|
|
|
|
|
|
2020-01-03 08:15:48 +08:00
|
|
|
Log telegraf.Logger `toml:"-"`
|
|
|
|
|
|
2019-11-09 03:55:37 +08:00
|
|
|
// the ethtool command
|
|
|
|
|
command Command
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const (
|
2020-12-19 01:04:02 +08:00
|
|
|
pluginName = "ethtool"
|
|
|
|
|
tagInterface = "interface"
|
|
|
|
|
tagDriverName = "driver"
|
|
|
|
|
fieldInterfaceUp = "interface_up"
|
2019-11-09 03:55:37 +08:00
|
|
|
)
|