openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
171 stars 55 forks source link

gnmic-relay: nats to influxdb configuration issues #153

Open smalenfant opened 1 year ago

smalenfant commented 1 year ago

I'm getting some strange results (or no results) when attempting to use a gnmic relay with nats. Are there limitation of event processing that can be done when using nats output/input? Are there limitation of outputs that can be used when using nats as an input?

First config, connect to targets and post messages into nats.

targets:
  - ...

subscriptions:
  interfaces:
    paths:
      - /interfaces/interface[name=et-1/0/7]
      #- /interfaces/interface[name=et*]
    mode: STREAM
    stream-mode: sample
    sample-interval: 10s

outputs:
  nats-output:
    type: nats
    address: nats:4222
    subject: telemetry

At this point, I know messages are in nats. When I'm trying to output the results of the relay on the screen, nothing shows up. Noticed that I put the "outputs" on the nats-input plugin (as the document says). But I believe this doesn't work.

inputs:
  nats-input:
    type: nats
    # debug: true
    # format: event
    address: localhost:4222
    subject: telemetry
    outputs:
      - processed
outputs:
  processed:
    type: file
    file-type: stdout
    format: event
    debug: true

I decided to add InfluxDB to the above configuration:

  influx-output:
    type: influxdb
    bucket: telemetry
    url: ...

With the above and removing "outputs" from the "nats-input", it does push the messages into InfluxDB.

Some notes:

To reproduce easily, looks like I should be bringing up containerlab.

karimra commented 1 year ago

Yes the limitation is with formats. File output does not support wiritng received event messages, only proto messages that it converts to event. For the processor, note that event-merge can only merge notifications received as part of the same subscribe response. To merge notifications received separately, you will have to use a cache. PS: I'm on PTO with limited access to a laptop for the rest of this week, I will be able to help a bit more starting next week.