Skip to content

gNMI plugin incorrectly truncates MAC addresses in field names #17279

@noredistribution

Description

@noredistribution

Relevant telegraf.conf

[[inputs.gnmi]]
  ## Address and port of the GNMI GRPC server
  addresses = ["172.100.100.105:6030", "172.100.100.106:6030"]

  ## credentials
  username = "arista"
  password = "arista"

  ## redial in case of failures after
  redial = "10s"
  [[inputs.gnmi.subscription]]
    name = "igmpsnooping900"
    origin = "eos_native"
    subscription_mode = "sample"
    path = "/Sysdb/bridging/igmpsnooping/forwarding/status/vlanStatus/900"
    sample_interval = "10s"
[[outputs.file]]
    files = ["stdout"]

Logs from Telegraf

logs are fine as there are no errors here

System info

Telegraf 1.35.1, AlmaLinux 9.6

Docker

No response

Steps to reproduce

Configure telegraf with gNMI plugin to collect data containing MAC addresses in paths
Use a gNMI path like:

eos_native:/Sysdb/bridging/igmpsnooping/forwarding/status/vlanStatus/900/ethGroup/01:00:5e:1e:1e:1e/intf

Expected behavior

igmpsnooping,host=telegraf,path=eos_native:/Sysdb/bridging/igmpsnooping/forwarding/status/vlanStatus/900/ethGroup/01:00:5e:1e:1e:1e/intf,source=172.100.100.105 900/ethGroup/01:00:5e:1e:1e:1e/intf/Ethernet1=true 1751459159001750895

Actual behavior

igmpsnooping,host=telegraf,path=eos_native:/Sysdb/bridging/igmpsnooping/forwarding/status/vlanStatus/900/ethGroup/01:00:5e:1e:1e:1e/intf,source=172.100.100.105 900/ethGroup/00:5e:1e:1e:1e/intf/Ethernet1=true 1751459159001750895

Additional info

The gNMI input plugin incorrectly truncates MAC addresses in field names by treating the first colon in MAC addresses as a namespace separator.

MAC addresses in gNMI paths should be preserved intact in the output field names.
Expected: 01:00:5e:1e:1e:1e
Actual: 00:5e:1e:1e:1e

Notice how the first octet is dropped ^

seems to be due to https://github.com/influxdata/telegraf/blob/master/plugins/inputs/gnmi/path.go#L191C1-L212C2 where there's a split on the first colon no matter the element, so the first part would get taken away as it is considered as a namespace even though it's not a yang ns in this case

Metadata

Metadata

Assignees

Labels

area/gnmibugunexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions