Add ethtool input plugin (#5865)
This commit is contained in:
committed by
Daniel Nelson
parent
6cbaf890d9
commit
d9ddd95b3c
46
plugins/inputs/ethtool/ethtool.go
Normal file
46
plugins/inputs/ethtool/ethtool.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package ethtool
|
||||
|
||||
import (
|
||||
"net"
|
||||
)
|
||||
|
||||
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"`
|
||||
|
||||
// the ethtool command
|
||||
command Command
|
||||
}
|
||||
|
||||
const (
|
||||
pluginName = "ethtool"
|
||||
tagInterface = "interface"
|
||||
tagDriverName = "driver"
|
||||
|
||||
sampleConfig = `
|
||||
## List of interfaces to pull metrics for
|
||||
# interface_include = ["eth0"]
|
||||
|
||||
## List of interfaces to ignore when pulling metrics.
|
||||
# interface_exclude = ["eth1"]
|
||||
`
|
||||
)
|
||||
|
||||
func (e *Ethtool) SampleConfig() string {
|
||||
return sampleConfig
|
||||
}
|
||||
|
||||
// Description returns a one-sentence description on the Input
|
||||
func (e *Ethtool) Description() string {
|
||||
return "Returns ethtool statistics for given interfaces"
|
||||
}
|
||||
Reference in New Issue
Block a user