Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnmi plugin: got empty metric-name for response on Nokia SRLinux #12931

Closed
protonmarco opened this issue Mar 24, 2023 · 5 comments · Fixed by #13304
Closed

gnmi plugin: got empty metric-name for response on Nokia SRLinux #12931

protonmarco opened this issue Mar 24, 2023 · 5 comments · Fixed by #13304
Assignees
Labels
area/gnmi bug unexpected problem or unintended behavior

Comments

@protonmarco
Copy link

Relevant telegraf.conf

[[inputs.gnmi]]
  alias = "leaf1"
  ## Address and port of the gNMI GRPC server
  addresses = ["leaf1:57400"]
  username = "admin"
  password = "NokiaSrl1!"
  redial = "10s"
  encoding="json_ietf"
  tagexclude = ["path","host"]
  enable_tls = true
  tls_ca = "/etc/telegraf/ssl-ca/ca.pem"
  tls_cert = "/etc/telegraf/ssl-cert/telegraf.pem"
  tls_key = "/etc/telegraf/ssl-cert/telegraf.key"
  insecure_skip_verify = false
  [[inputs.gnmi.subscription]]
    name = "interface"
    origin = ""
    path = "/interface"
    subscription_mode = "sample"
    sample_interval = "10s"

Logs from Telegraf

2023-03-24T10:02:10+01:00 W! [inputs.gnmi::leaf1] Got empty metric-name for response, usually indicating
configuration issues as the response cannot be related to any subscription.
Please open an issue on https://github.com/influxdata/telegraf including your
device model and the following response data:
timestamp:1679648530391910312  update:{path:{origin:"srl_nokia-interfaces"  elem:{name:"interface"  key:{key:"name"  value:"ethernet-1/1"}}}  val:{json_ietf_val:"{\"admin-state\": \"disable\", \"ifindex\": 16382, \"oper-state\": \"down\", \"oper-down-reason\": \"port-admin-disabled\", \"last-change\": \"2023-03-24T09:02:02.518Z\"}"}}  update:{path:{origin:"srl_nokia-interfaces"  elem:{name:"interface"  key:{key:"name"  value:"ethernet-1/1"}}  elem:{name:"transceiver"}}  val:{json_ietf_val:"{\"tx-laser\": false, \"oper-state\": \"down\", \"oper-down-reason\": \"not-present\", \"ddm-events\": false, \"forward-error-correction\": \"disabled\"}"}}  update:{path:{origin:"srl_nokia-interfaces"  elem:{name:"interface"  key:{key:"name"  value:"ethernet-1/1"}}  elem:{name:"ethernet"}}  val:{json_ietf_val:"{\"dac-link-training\": true, \"port-speed\": \"25G\", \"hw-mac-address\": \"1A:FB:03:FF:00:01\"}"}}  update:{path:{origin:"srl_nokia-interfaces"  elem:{name:"interface"  key:{key:"name"  value:"ethernet-1/1"}}  elem:{name:"ethernet"}  elem:{name:"flow-control"}}  val:{json_ietf_val:"{\"receive\": false}"}}  update:{path:{origin:"srl_nokia-interfaces"  elem:{name:"interface"  key:{key:"name"  value:"ethernet-1/1"}}  elem:{name:"sflow"}}  val:{json_ietf_val:"{\"admin-state\": \"disable\"}"}}
This message is only printed once.

System info

Telegraf 1.26, Nokia SR Linux v22.11.2

Docker

The problem can be reproduced with containerlab on the lab created with this repo.
Once everything is up, it can be seen with docker logs clab-collectors-telegraf.

Steps to reproduce

  1. Turn on the lab as explained in the readme
  2. Check:
  • the empty metric-name logs of the telegraf container

Expected behavior

No such logs.

Actual behavior

Empty metric-name logs are present.

Additional info

No response

@protonmarco protonmarco added the bug unexpected problem or unintended behavior label Mar 24, 2023
@powersj
Copy link
Contributor

powersj commented Mar 28, 2023

@srebhan thoughts on this one as well?

@srebhan
Copy link
Member

srebhan commented Mar 29, 2023

In the error the returned message shows an origin

timestamp:1679648530391910312 update:{path:{origin:"srl_nokia-interfaces" elem:{name:"interface" key: [...]
@protonmarco, can you please try to set

    origin = "srl_nokia-interfaces"

in the config and see if this fixes your issue!?

@hellt
Copy link
Contributor

hellt commented Mar 29, 2023

Hi @srebhan
but this srl_nokia-interfaces is not the origin. As per gNMI spec (https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#222-paths)

origin - a field which MAY be used to disambiguate the path if necessary. For example, the origin may be used to indicate which organization defined the schema to which the path belongs.

In current gNMI versions, path origins are used to disambiguate which schema the path belongs, most commonly two origins are used native and openconfig.

srl_nokia-interfaces is not the path origin, per se, it is a YANG module name in which this path is defined.

I presume what is happening, is that telegraf's gnmi input parses the output which is formed in JSON_IETF encoding and carves out the part before : char treating this as path origin. But it is not.

Here is a raw textproto response of a similar subscribe request done with gnmic:

gnmic -a clab-ansible-srl -u admin -p NokiaSrl1! --skip-verify -e JSON_IETF \
          subscribe --path "/interface[name=mgmt0]/description" --format prototext
sync_response: true

update: {
  timestamp: 1680101198495813448
  update: {
    path: {
      elem: {
        name: "srl_nokia-interfaces:interface"
        key: {
          key: "name"
          value: "mgmt0"
        }
      }
      elem: {
        name: "description"
      }
    }
    val: {
      json_ietf_val: "\"clab-ansible-srl management interface\""
    }
  }
}

^C
received signal 'interrupt'. terminating...

As you can see, path origin is not present in the response.

@srebhan
Copy link
Member

srebhan commented May 22, 2023

@protonmarco can you please test the binary built in PR #13304 and let me know if this fixes your issue?

@protonmarco
Copy link
Author

Looks like it fixed the issue, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gnmi bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants