* Add --collector.netdev.device-whitelist flag
Sometimes it is desired to monitor only one netdev. The golang regexp
does not support a negated regex, so the ignored-devices flag is too
cumbersome for this task.
This change introduces a new flag: accept-devices, which is mutually
exclusive to ignored-devices. This flag allows specifying ONLY the
netdev you'd like.
Signed-off-by: Noam Meltzer <noam@cynerio.co>
* The netdev collector CLI argument `--collector.netdev.ignored-devices` was renamed to `--collector.netdev.device-blacklist` in order to conform with the systemd collector. #1279
netdevIgnoredDevices=kingpin.Flag("collector.netdev.ignored-devices","Regexp of net devices to ignore for netdev collector.").Default("^$").String()
netdevIgnoredDevices=kingpin.Flag("collector.netdev.device-blacklist","Regexp of net devices to blacklist (mutually exclusive to device-whitelist).").String()
netdevAcceptDevices=kingpin.Flag("collector.netdev.device-whitelist","Regexp of net devices to whitelist (mutually exclusive to device-blacklist).").String()
)
typenetDevCollectorstruct{
subsystemstring
ignoredDevicesPattern*regexp.Regexp
acceptDevicesPattern*regexp.Regexp
metricDescsmap[string]*prometheus.Desc
}
@ -41,16 +44,30 @@ func init() {
// NewNetDevCollector returns a new Collector exposing network device stats.