diff --git a/collector/ethtool_linux.go b/collector/ethtool_linux.go index 0aa9239a..233cbd8f 100644 --- a/collector/ethtool_linux.go +++ b/collector/ethtool_linux.go @@ -38,12 +38,6 @@ import ( "gopkg.in/alecthomas/kingpin.v2" ) -const ( - // These are in _bytes_ to match bytes-per-second speeds from netclass. - Mbps = 1000000.0 / 8.0 - Gbps = 1000.0 * Mbps -) - var ( ethtoolDeviceInclude = kingpin.Flag("collector.ethtool.device-include", "Regexp of ethtool devices to include (mutually exclusive to device-exclude).").String() ethtoolDeviceExclude = kingpin.Flag("collector.ethtool.device-exclude", "Regexp of ethtool devices to exclude (mutually exclusive to device-include).").String() @@ -268,75 +262,46 @@ func (c *ethtoolCollector) updatePortInfo(ch chan<- prometheus.Metric, device st // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/ethtool.h func (c *ethtoolCollector) updateSpeeds(ch chan<- prometheus.Metric, prefix string, device string, linkModes uint32) { linkMode := fmt.Sprintf("%s_speed", prefix) + const ( + full = "full" + half = "half" + // This is in _bytes_ to match bytes-per-second speeds from netclass. + Mbps = 1000000.0 / 8.0 + ) - if linkModes&(1<