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

Support for bytes encoding for "gnmi" input plugin #7938

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

hellt
Copy link
Contributor

@hellt hellt commented Aug 4, 2020

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

Purpose of the PR

This PR adds support for bytes encoding for the gNMI messages as per 2.3.2 of gNMI specification.

The code already had a support for bytes encoded values, it was just not allowed to specify this encoding in the appropriate check before.

The only changes made to the plugin were to allow to specify bytes as the encoding.

Example

Config file:

[[inputs.gnmi]]
  addresses = ["r1:14946"]
  username = "admin"
  password = "nokia"

  encoding = "bytes"

  redial = "10s"

  [[inputs.gnmi.subscription]]
    name = "test-bytes-encoding"
    path = "/state/system/version/version-number"
    subscription_mode = "sample"
    sample_interval = "2s"

[[outputs.file]]
  files = ["stdout", "/tmp/metrics.out"]
  data_format = "influx"

Output:

❯ ./telegraf --config __test_config.toml
2020-08-04T09:29:36Z I! Starting Telegraf 
2020-08-04T09:29:36Z I! Loaded inputs: gnmi
2020-08-04T09:29:36Z I! Loaded aggregators: 
2020-08-04T09:29:36Z I! Loaded processors: 
2020-08-04T09:29:36Z I! Loaded outputs: file
2020-08-04T09:29:36Z I! Tags enabled: host=mbp-2.local
2020-08-04T09:29:36Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"mbp-2.local", Flush Interval:10s
test-bytes-encoding,host=mbp-2.local,path=/state/system/version,source=0.tcp.eu.ngrok.io version_number="B-20.5.R1" 1596533379127528433

@hellt
Copy link
Contributor Author

hellt commented Aug 5, 2020

Hi @danielnelson, I am not sure if you are the intended reviewer for that domain?

Copy link
Contributor

@ssoroka ssoroka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. There's also an ASCII encoding. should we be supporting that, too?

@hellt
Copy link
Contributor Author

hellt commented Oct 28, 2020 via email

@ssoroka
Copy link
Contributor

ssoroka commented Oct 29, 2020

looks like at the moment ascii is not part of the docs and will complain that it's not a supported type.

@hellt
Copy link
Contributor Author

hellt commented Oct 29, 2020 via email

@hellt
Copy link
Contributor Author

hellt commented Oct 31, 2020

@ssoroka can we merge this one and address ASCII later? Thank you

@ssoroka ssoroka merged commit 68a4f18 into influxdata:master Nov 2, 2020
@ssoroka
Copy link
Contributor

ssoroka commented Nov 2, 2020

Merged. Thank you!

ssoroka pushed a commit that referenced this pull request Nov 13, 2020
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants