gnmic
gnmic copied to clipboard
Question: What format to be used for targets added in consul
Hi, I am using loader type consul to load the targets. I am not sure what format I have to use. Here is my gnmic config file
username: user
password: passowrd
port: 50051
timeout: 35s
insecure: true
encoding: PROTO
log-file: ./gnmic.log
subscriptions:
negotiated-speed:
paths:
- "/interfaces/interface/ethernet/state/negotiated-port-speed"
mode: STREAM
stream-mode: target-defined
sample-interval: 10s
outputs:
- output0
outputs:
output0:
type: file
file-type: stdout
format: event
api-server:
address: :7890
timeout: 10s
client-auth: ""
enable-metrics: true
debug: false
loader:
type: consul
address: 127.0.0.1:55001
datacenter: dc1
username:
password:
token:
key-prefix: gnmic/config/targets
enable-metrics: false
services:
- name: cluster1-gnmi-server
tags:
config:
on-add:
on-delete:
vars:
vars-file:
clustering:
cluster-name: default-cluster
instance-name: "new-instance-1"
service-address: ""
services-watch-timer: 60s
targets-watch-timer: 20s
target-assignment-timeout: 10s
leader-wait-timer: 5s
tags: []
locker:
type: consul
address: localhost:55001
datacenter:
username:
password:
token:
session-ttl: 10s
delay: 5s
retry-timer: 2s
renew-period: 5s
debug: false
I have created gnmic/config/targets folder in consul KV store added following content
10.4.0.5:
address: 10.4.0.5
timeout: 10s
subscriptions:
- negotiated-speed
10.4.0.2:
address: 10.4.0.2
timeout: 10s
subscriptions:
- negotiated-speed
Thank you
Consul discovery does not work that way. The config assigned to a target goes in the config file not in Consul.
You register your targets as instances of a Service in Consul. Then you set the config you want applied to each group (a Consul Service) under loader.services[].config.
There is an example in this issue