-
Notifications
You must be signed in to change notification settings - Fork 13
/
ethtool.go
47 lines (37 loc) · 1.17 KB
/
ethtool.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package ethtool
import (
"net"
"github.com/circonus-labs/circonus-unified-agent/cua"
)
type Command interface {
Init() error
DriverName(intf string) (string, error)
Interfaces() ([]net.Interface, error)
Stats(intf string) (map[string]uint64, error)
}
type Ethtool struct {
Log cua.Logger `toml:"-"`
// the ethtool command
command Command
InterfaceInclude []string `toml:"interface_include"` // This is the list of interface names to include
InterfaceExclude []string `toml:"interface_exclude"` // This is the list of interface names to ignore
}
const (
pluginName = "ethtool"
tagInterface = "interface" //nolint:deadcode,varcheck
tagDriverName = "driver" //nolint:deadcode,varcheck
sampleConfig = `
instance_id = "" # unique instance identifier (REQUIRED)
## 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"
}