Suppress unsupported interfaces from being reported on by Telegraf

Hi, I noticed below lines repeated frequently in /var/log/messages which prompted me to dig a bit and create a proper bug report :slight_smile:

Issue:
Unsupported interfaces (pppoe, tunnel, wireguard) are picked up by Telegraf and appearing /var/log/messages with very frequent occurrence in log file.

Mar  4 21:36:45 <hostname> telegraf[131801]: 2024-03-05T02:36:45Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  4 21:36:45 <hostname> telegraf[131801]: 2024-03-05T02:36:45Z E! [inputs.ethtool] Error in plugin: "tun0" stats: operation not supported
Mar  4 21:36:45 <hostname> telegraf[131801]: 2024-03-05T02:36:45Z E! [inputs.ethtool] Error in plugin: "sit0" stats: operation not supported
Mar  4 21:36:45 <hostname> telegraf[131801]: 2024-03-05T02:36:45Z E! [inputs.ethtool] Error in plugin: "wg01" stats: operation not supported
Mar  4 21:36:45 <hostname> telegraf[131801]: 2024-03-05T02:36:45Z E! [inputs.ethtool] Error in plugin: "pppoe0" stats: operation not supported
Mar  4 21:37:03 <hostname> telegraf[131801]: 2024-03-05T02:37:03Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  4 21:37:03 <hostname> telegraf[131801]: 2024-03-05T02:37:03Z E! [inputs.ethtool] Error in plugin: "tun0" stats: operation not supported
Mar  4 21:37:03 <hostname> telegraf[131801]: 2024-03-05T02:37:03Z E! [inputs.ethtool] Error in plugin: "wg01" stats: operation not supported
Mar  4 21:37:03 <hostname> telegraf[131801]: 2024-03-05T02:37:03Z E! [inputs.ethtool] Error in plugin: "pppoe0" stats: operation not supported
Mar  4 21:37:03 <hostname> telegraf[131801]: 2024-03-05T02:37:03Z E! [inputs.ethtool] Error in plugin: "sit0" stats: operation not supported

Cause:
Script “/etc/telegraf/custom_scripts/show_interfaces_input_filter.py” at bottom of /run/telegraf/telegraf.conf includes these problematic interfaces.

# Generated by /usr/libexec/vyos/conf_mode/service_monitoring_telegraf.py

...
...
### InfluxDB2 ###
[[outputs.influxdb_v2]]
  urls = ["http://localhost:8086"]
  insecure_skip_verify = true
  token = "$INFLUX_TOKEN"
  organization = "vyos"
  bucket = "bucket_vyos"
### End InfluxDB2 ###
...
...
[[inputs.ethtool]]
  interface_include = ['eth0', 'eth1', 'eth2']
...
...
[[inputs.exec]]
  commands = [
    "/etc/telegraf/custom_scripts/show_firewall_input_filter.py",
    "/etc/telegraf/custom_scripts/show_interfaces_input_filter.py",
    "/etc/telegraf/custom_scripts/vyos_services_input_filter.py"
  ]
...
user@<hostname>:~$ python3 /etc/telegraf/custom_scripts/show_interfaces_input_filter.py
show_interfaces,interface=eth0 ip_addresses="xxx.xxx.xxx.xxx/24",state=0i,link=0i,description="WAN" 1709607132000000000
show_interfaces,interface=eth1 ip_addresses="xxx.xxx.xxx.xxx/24",state=0i,link=0i,description="LAN" 1709607132000000000
show_interfaces,interface=eth2 ip_addresses="-",state=0i,link=1i,description="empty" 1709607132000000000
show_interfaces,interface=lo ip_addresses="127.0.0.1/8 ::1/128",state=0i,link=0i,description="empty" 1709607132000000000
show_interfaces,interface=pppoe0 ip_addresses="xxx.xxx.xxx.xxx/32",state=0i,link=0i,description="bell-fibe" 1709607132000000000
show_interfaces,interface=tun0 ip_addresses="2XXX:XXX:XX:XXX::X/64",state=2i,link=1i,description="HE.NET IPv6 Tunnel" 1709607132000000000
show_interfaces,interface=wg01 ip_addresses="XX.XX.XX.XX/24",state=0i,link=0i,description="remote admin" 1709607132000000000
user@<hostname>:~$

Fix
Either:

  1. Quick and dirty: delete line “/etc/telegraf/custom_scripts/show_interfaces_input_filter.py” from /run/telegraf/telegraf.conf since eth0/1/2 interfaces already mentioned in config file making python script not needed (I’m not sure what the purpose of including that python script was for but if removing it cause needed interfaces from being suppressed then propose solution 2)
    -or-
  2. More elegant: modify show_interfaces_input_filter.py to exclude interfaces that aren’t supported by Telegraf (I suspect anything that isn’t an ethX will probably give error)

But show_interfaces doesn’t use ethtool. It shows you only states, description and counters. You will lose those data if you delete this script.
On another hand you provide only “ethX” interfaces in the config

What for ethtool looks correctly

1 Like

Thank @Viacheslav,

Per your feedback, I tried fixing this a different way but first flushed everything related to influx and telegraf in case some previous config was causing the issue. Having deleted the influx container and all traces of influx and telegraf from my configuration and reinstated:

I subsequently created an inputs.conf configuration file to /etc/telegraf/telegraf.d to specify the list of interfaces to exclude.

[[inputs.ethtool]]
  ## List of interfaces to ignore when pulling metrics.
  interface_exclude = ['wg*','tun*','pppoe*','sit*']

Having done this seems to have removed 4 of 5 interfaces from appearing in the message log. I still have the pim6reg driver appearing however… (not sure how to suppress that at this time).

user1@<hostname>:~$ cat /var/log/messages | grep "inputs.ethtool"
Mar  5 11:33:00 <hostname> telegraf[307940]: 2024-03-05T16:33:00Z I! Loading config: /etc/telegraf/telegraf.d/inputs_ethtool.conf
Mar  5 11:33:18 <hostname> telegraf[307940]: 2024-03-05T16:33:18Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:33:34 <hostname> telegraf[307940]: 2024-03-05T16:33:34Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:33:48 <hostname> telegraf[307940]: 2024-03-05T16:33:48Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:34:04 <hostname> telegraf[307940]: 2024-03-05T16:34:04Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:34:18 <hostname> telegraf[307940]: 2024-03-05T16:34:18Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:34:31 <hostname> telegraf[307940]: 2024-03-05T16:34:31Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:34:48 <hostname> telegraf[307940]: 2024-03-05T16:34:48Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:35:02 <hostname> telegraf[307940]: 2024-03-05T16:35:02Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:35:15 <hostname> telegraf[307940]: 2024-03-05T16:35:15Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:35:32 <hostname> telegraf[307940]: 2024-03-05T16:35:32Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:35:49 <hostname> telegraf[307940]: 2024-03-05T16:35:49Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:36:01 <hostname> telegraf[307940]: 2024-03-05T16:36:01Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:36:16 <hostname> telegraf[307940]: 2024-03-05T16:36:16Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:36:32 <hostname> telegraf[307940]: 2024-03-05T16:36:32Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:36:49 <hostname> telegraf[307940]: 2024-03-05T16:36:49Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:37:00 <hostname> telegraf[307940]: 2024-03-05T16:37:00Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:37:17 <hostname> telegraf[307940]: 2024-03-05T16:37:17Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:37:33 <hostname> telegraf[307940]: 2024-03-05T16:37:33Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:37:46 <hostname> telegraf[307940]: 2024-03-05T16:37:46Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:38:01 <hostname> telegraf[307940]: 2024-03-05T16:38:01Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:38:19 <hostname> telegraf[307940]: 2024-03-05T16:38:19Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:38:33 <hostname> telegraf[307940]: 2024-03-05T16:38:33Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:38:47 <hostname> telegraf[307940]: 2024-03-05T16:38:47Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
Mar  5 11:39:03 <hostname> telegraf[307940]: 2024-03-05T16:39:03Z E! [inputs.ethtool] Error in plugin: "pim6reg" driver: operation not supported
... continued ...