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 openconfig binary parsing not functioning correctly #16365

Open
mattg66 opened this issue Jan 3, 2025 · 0 comments
Open

GNMI openconfig binary parsing not functioning correctly #16365

mattg66 opened this issue Jan 3, 2025 · 0 comments
Labels
bug unexpected problem or unintended behavior

Comments

@mattg66
Copy link

mattg66 commented Jan 3, 2025

Relevant telegraf.conf

[agent]
  hostname = "telegraf-01"
  debug = true
[[inputs.gnmi]]
    addresses = ["xx:5909"]
    username = "${GNMI_USERNAME}"
    password = "${GNMI_PASSWORD}"
    ## redial in case of failures after
    redial = "10s"
    dump_responses = true

    yang_model_paths = [
        "/etc/telegraf/openconfig/release/models/",
        "/etc/telegraf/openconfig/third_party/ietf/",
    ]
    [inputs.gnmi.tags]
      device = "xx"
      serial_number = "xx"
      model_name = "DCS-7050CX3-32S"
    [[inputs.gnmi.subscription]]
        name = "state"
        origin = "openconfig"
        path = "/components/component/state"
        subscription_mode = "on_change"
    [[inputs.gnmi.subscription]]
        name = "cpu"
        origin = "openconfig"
        path = "/components/component/cpu/utilization/state"
        subscription_mode = "on_change"
    [[inputs.gnmi.subscription]]
        name = "psu"
        origin = "openconfig"
        path = "/components/component/power-supply/state"
        subscription_mode = "on_change"
    [[inputs.gnmi.subscription]]
        name = "fan"
        origin = "openconfig"
        path = "/components/component/fan/state"
        subscription_mode = "on_change"
    [[inputs.gnmi.subscription]]
        name = "ifcounters"
        origin = "openconfig"
        path = "/interfaces/interface/state/counters"
        subscription_mode = "on_change"
[[outputs.file]]
  files = ["stdout"]

[[outputs.influxdb]]
  # destination influxdb xxx
  urls = ["https://xx"]
  database = "ARISTA_SWITCHING"
  retention_policy = ""
  username = "xx"
  password = "xx"
  write_consistency = "any"
  timeout = "5s"
  ssl_ca = ""
  ssl_cert = ""
  ssl_key = ""
  insecure_skip_verify = true

Logs from Telegraf

2025-01-03T16:49:41Z D! [inputs.gnmi] Got update_1735922981156731216: {"update":{"timestamp":"1735922981156731216","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply2"}},{"name":"power-supply"},{"name":"state"},{"name":"input-current"}]},"val":{"bytesVal":"Po8AAA=="}}]}}

2025-01-03T16:49:41Z D! [inputs.gnmi] Got update_1735922981156821374: {"update":{"timestamp":"1735922981156821374","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply2"}},{"name":"power-supply"},{"name":"state"},{"name":"output-power"}]},"val":{"bytesVal":"QjIAAA=="}}]}}

2025-01-03T16:49:41Z D! [inputs.gnmi] Got update_1735922981483943425: {"update":{"timestamp":"1735922981483943425","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply1"}},{"name":"power-supply"},{"name":"state"},{"name":"output-power"}]},"val":{"bytesVal":"QlBAAA=="}}]}}

2025-01-03T16:49:46Z D! [inputs.gnmi] Got update_1735922986368663745: {"update":{"timestamp":"1735922986368663745","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply2"}},{"name":"power-supply"},{"name":"state"},{"name":"input-current"}]},"val":{"bytesVal":"Po4AAA=="}}]}}

2025-01-03T16:49:46Z D! [inputs.gnmi] Got update_1735922986368737133: {"update":{"timestamp":"1735922986368737133","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply2"}},{"name":"power-supply"},{"name":"state"},{"name":"output-current"}]},"val":{"bytesVal":"QHGAAA=="}}]}}

2025-01-03T16:49:46Z D! [inputs.gnmi] Got update_1735922986368762428: {"update":{"timestamp":"1735922986368762428","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply2"}},{"name":"power-supply"},{"name":"state"},{"name":"output-voltage"}]},"val":{"bytesVal":"QT/4AA=="}}]}}

2025-01-03T16:49:46Z D! [inputs.gnmi] Got update_1735922986368776845: {"update":{"timestamp":"1735922986368776845","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply2"}},{"name":"power-supply"},{"name":"state"},{"name":"output-power"}]},"val":{"bytesVal":"QjUAAA=="}}]}}

2025-01-03T16:49:46Z D! [inputs.gnmi] Got update_1735922986697451141: {"update":{"timestamp":"1735922986697451141","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply1"}},{"name":"power-supply"},{"name":"state"},{"name":"output-current"}]},"val":{"bytesVal":"QIkAAA=="}}]}}

2025-01-03T16:49:46Z D! [inputs.gnmi] Got update_1735922986697531925: {"update":{"timestamp":"1735922986697531925","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply1"}},{"name":"power-supply"},{"name":"state"},{"name":"output-voltage"}]},"val":{"bytesVal":"QUBoAA=="}}]}}

2025-01-03T16:49:46Z D! [inputs.gnmi] Got update_1735922986697545778: {"update":{"timestamp":"1735922986697545778","update":[{"path":{"elem":[{"name":"components"},{"name":"component","key":{"name":"PowerSupply1"}},{"name":"power-supply"},{"name":"state"},{"name":"output-power"}]},"val":{"bytesVal":"Qk2AAA=="}}]}}

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply2,serial_number=xx,source=172.25.8.33 input_current=">�" 1735922981156731216

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply2,serial_number=xx,source=172.25.8.33 output_power="B2" 1735922981156821374

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply1,serial_number=xx,source=172.25.8.33 output_power="BP@" 1735922981483943425

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply2,serial_number=xx,source=172.25.8.33 input_current=">�" 1735922986368663745

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply2,serial_number=xx,source=172.25.8.33 output_current="@q�" 1735922986368737133

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply2,serial_number=xx,source=172.25.8.33 output_voltage="A?�" 1735922986368762428

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply2,serial_number=xx,source=172.25.8.33 output_power="B5" 1735922986368776845

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply1,serial_number=xx,source=172.25.8.33 output_current="@�" 1735922986697451141

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply1,serial_number=xx,source=172.25.8.33 output_voltage="A@h" 1735922986697531925

psu,device=xx,host=telegraf-01,model_name=DCS-7050CX3-32S,name=PowerSupply1,serial_number=xx,source=172.25.8.33 output_power="BM�" 1735922986697545778

System info

Telegraf 1.33.0 Docker

Docker

services:
telegraf:
image: telegraf:latest
container_name: telegraf-01
restart: unless-stopped
environment:
- GNMI_USERNAME=${GNMI_USERNAME}
- GNMI_PASSWORD=${GNMI_PASSWORD}
networks:
- monitoring
volumes:
- /root/telegraf-01-config.conf:/etc/telegraf/telegraf.conf:ro
- /root/openconfig:/etc/telegraf/openconfig:ro
- /root/arista-yang:/etc/telegraf/arista-yang:ro
networks:
monitoring:
external: true

Steps to reproduce

  1. Using an Arista switch running EOS 4.31.4M, connect using GNMI to retrieve power supply state via openconfig
  2. Expect telegraf to pass data as YANG models are provided
  3. Telegraf exports wrongly converted data out to the database
    ...

Expected behavior

Telegraf to convert the bytesVal into human readable.

gNMI response from yangsuite is:

update { path { elem { name: "components" } elem { name: "component" key { key: "name" value: "PowerSupply1" } } elem { name: "power-supply" } elem { name: "state" } } val { json_ietf_val: "{"openconfig-platform-psu:capacity":"Q/oAAA==","openconfig-platform-psu:input-current":"PqQAAA==","openconfig-platform-psu:input-voltage":"Q22AAA==","openconfig-platform-psu:output-current":"QIrAAA==","openconfig-platform-psu:output-power":"Qk3AAA==","openconfig-platform-psu:output-voltage":"QUAwAA=="}" } } update { path { elem { name: "components" } elem { name: "component" key { key: "name" value: "PowerSupply2" } } elem { name: "power-supply" } elem { name: "state" } } val { json_ietf_val: "{"openconfig-platform-psu:capacity":"Q/oAAA==","openconfig-platform-psu:input-current":"Po0AAA==","openconfig-platform-psu:input-voltage":"Q2PAAA==","openconfig-platform-psu:output-current":"QHGAAA==","openconfig-platform-psu:output-power":"QjUAAA==","openconfig-platform-psu:output-voltage":"QUAwAA=="}" } } }

Actual behavior

It converts it to garbage

Additional info

No response

@mattg66 mattg66 added the bug unexpected problem or unintended behavior label Jan 3, 2025
@mattg66 mattg66 changed the title GNMI openconfig PSU conversion problems GNMI openconfig binary parsing not functioning correctly Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant