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

Question: What format to be used for targets added in consul #515

Open
viinay opened this issue Aug 29, 2024 · 1 comment
Open

Question: What format to be used for targets added in consul #515

viinay opened this issue Aug 29, 2024 · 1 comment

Comments

@viinay
Copy link

viinay commented Aug 29, 2024

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

@karimra
Copy link
Collaborator

karimra commented Sep 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants