Skip to content

Introduction

In the context of gnmi subscriptions (on top of terminal output) gnmic supports multiple output options:

outputs

These outputs can be mixed and matched at will with the different gnmi subscribe targets.

With multiple outputs defined in the configuration file you can collect once and export the formatted subscriptions updates to multiple locations.

Defining outputs#

To define an output a user needs to create the outputs section in the configuration file:

# part of ~/gnmic.yml config file
outputs:
  group1:
    - type: file # output type
      file-type: stdout # or stderr
    - type: file
      filename: /path/to/localFile.log  
  group2:
    - type: nats # output type
      address: 127.0.0.1:4222 # comma separated nats servers addresses
      subject-prefix: telemetry #
    - type: file
      filename: /path/to/localFile.log  
  group3:
    - type: stan # output type
      address: 127.0.0.1:4223 # comma separated nats streaming servers addresses
      subject: telemetry #
      cluster-name: test-cluster #
  group4:
    - type: kafka # output type
      address: localhost:9092 # comma separated kafka brokers addresses
      topic: telemetry # kafka topic
    - type: stan # output type
      address: 127.0.0.1:4223 # comma separated nats streaming servers addresses
      subject: telemetry
      cluster-name: test-cluster

Outputs can be defined in groups to be able to match a target with multiple outputs at once,

Binding outputs#

Once the outputs are defined, they can be flexibly associated with the targets.

# part of ~/gnmic.yml config file
targets:
  router1.lab.com:
    username: admin
    password: secret
    outputs:
      - group1
      - group3
  router2.lab.com:
    username: gnmi
    password: telemetry
    outputs:
      - group2
      - group3
      - group4