Telegraf : inputs.gnmi (proto encoding) on a Nokia SR OS device

Hello, I’m trying to subscribe to a Nokia device (SR OS 21) with proto encoding.

Everything works fine with JSON encoding, but I don’t seem to make the proto encoding work. I guess I’m doing something wrong ?

The configuration is pretty simple :

[[inputs.gnmi]]
addresses = [“ip_address:57400”]
username = “admin”
password = “admin”
redial = “10s”
encoding = “proto”

[[inputs.gnmi.subscription]]
name = “test”
origin = “openconfig”
path = “/interfaces/”
subscription_mode = “sample”
sample_interval = “10s”


As stated earlier, the configuration is working fine if I just replace “encoding = proto” with “encoding = json”.

I understand that I need a yang file so I downloaded them from Github (with the related imports) and put them in my home directory (where is my config file), but it’s not working. I tried to change the “origin” parameter : “openconfig”, “openconfig-interfaces”, “interfaces”, not working.

Any help appreciated, here is how it looks when I run it :

$ telegraf --config tele_nokia.conf --debug
2021-07-30T05:50:43Z I! Starting Telegraf 1.19.2
2021-07-30T05:50:43Z I! Loaded inputs: gnmi
2021-07-30T05:50:43Z I! Loaded aggregators:
2021-07-30T05:50:43Z I! Loaded processors:
2021-07-30T05:50:43Z I! Loaded outputs: file
2021-07-30T05:50:43Z I! Tags enabled: host=hostname
2021-07-30T05:50:43Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“hostname”, Flush Interval:10s
2021-07-30T05:50:43Z D! [agent] Initializing plugins
2021-07-30T05:50:43Z D! [agent] Connecting outputs
2021-07-30T05:50:43Z D! [agent] Attempting connection to [outputs.file]
2021-07-30T05:50:43Z D! [agent] Successfully connected to outputs.file
2021-07-30T05:50:43Z D! [agent] Starting service inputs
2021-07-30T05:50:43Z D! [inputs.gnmi] Connection to gNMI device ip_address:57400 established
2021-07-30T05:50:53Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2021-07-30T05:50:53Z D! [inputs.gnmi] Connection to gNMI device ip_address:57400 closed
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x168feab]

goroutine 51 [running]:
github .com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).handlePath(0xc000878780, 0x0, 0xc000379a48, 0x0, 0x0, 0x30, 0x30, 0x4c97fa0, 0xc000379880, 0x8a73d5, …)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:395 +0xab
github .com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).handleTelemetryField(0xc000878780, 0xc001280580, 0xc000379a48, 0x0, 0x0, 0x5, 0x0, 0x0)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:336 +0x77
github .com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).handleSubscribeResponseUpdate(0xc000878780, 0xc00073c151, 0x10, 0xc000135528)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:283 +0x3f1
github .com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).handleSubscribeResponse(0xc000878780, 0xc00073c151, 0x10, 0xc0007572c0)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:253 +0x70
github .com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).subscribeGNMI(0xc000878780, 0x58e03b0, 0xc0006c3620, 0xc00073c151, 0x10, 0x0, 0xc0007563c0, 0x0, 0x0)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:245 +0x5a8
github .com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).Start.func1(0xc000878780, 0xc0007640d0, 0xc000134b58, 0xc000134b60, 0x590fe58, 0xc00057abe0, 0xc00073c151, 0x10)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:147 +0xf5
created by github .com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).Start
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:144 +0x3dd

Hi,
Could you try?

origin = “openconfig-interfaces”
path = “/interfaces”

If i remember correctly, this worked for me with Cisco IOSXR.

Hi Patrikh,

I tried this and unfortunately got the same result :frowning:

2021-07-30T09:35:18Z D! [inputs.gnmi] Connection to gNMI device ip_address:57400 closed
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x168feab]

goroutine 25 [running]:
github. com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).handlePath(0xc000602a80, 0x0, 0xc001243a48, 0x0, 0x0, 0x30, 0x30, 0x4c97fa0, 0xc001243880, 0x8a73d5, …)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:395 +0xab
github. com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).handleTelemetryField(0xc000602a80, 0xc000dda2c0, 0xc001243a48, 0x0, 0x0, 0x5, 0x0, 0x0)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:336 +0x77
github. com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).handleSubscribeResponseUpdate(0xc000602a80, 0xc00120a151, 0x10, 0xc000302450)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:283 +0x3f1
github. com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).handleSubscribeResponse(0xc000602a80, 0xc00120a151, 0x10, 0xc001223310)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:253 +0x70
github. com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).subscribeGNMI(0xc000602a80, 0x58e03b0, 0xc001219260, 0xc00120a151, 0x10, 0x0, 0xc0012223c0, 0x0, 0x0)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:245 +0x5a8
github. com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).Start.func1(0xc000602a80, 0xc001208310, 0xc0000103e0, 0xc0000103e8, 0x590fe58, 0xc00088aba0, 0xc00120a151, 0x10)
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:147 +0xf5
created by github. com/influxdata/telegraf/plugins/inputs/gnmi.(*GNMI).Start
/go/src/github.com/influxdata/telegraf/plugins/inputs/gnmi/gnmi.go:144 +0x3dd

another thing which you can test is different tool, gnmic is developed by guys from nokia.
you can even use it instead of telegraf.gnmi

try same subscription with this tool, to verify device/telegraf problem
https://gnmic.kmrd.dev/user_guide/prompt_suggestions/#nokia-sr-os

Actually, I’m doing some kind of comparative tests between gNMIc and Telegraf :smiley:

With gNMIc, it works with the “proto” encoding. Still, I need to provide a proto file (that I downloaded from Nokia’s Github) as a parameter (gnmic sub --config config.yaml --proto-file nokia-sros-combined-model.proto).

In fact, I think/suspect my problem could come from providing the file to Telegraf. I didn’t find any parameter except the “origin”, I tried to put the proto file path into “origin” (with and without extension), but it doesn’t seem to work either…

I was wondering if I should put the file somewhere or compile Telegraf from the sources and including the proto file somewhere… I’m a little lost, but thank you Patrikh for trying to help me !

I did some more tests and even if I’m not a developer, I looked at the source code of the gNMI plugin.

Correct me if I’m wrong, but it looks like the proto files (and thus, the proto encoding) are not handled at all (hence the errors).

I think I will make a request on Github to make the documentation a little clearer because if I’m correct, we can specify an option that is not supported and could really trick people (like me !) into thinking the proto files/encoding can be used with gNMI plugin.