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

Translate snmp field values #8466

Merged

Conversation

LeadingMoominExpert
Copy link
Contributor

@LeadingMoominExpert LeadingMoominExpert commented Nov 24, 2020

Required for all PRs:

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

Fixes #8458

@sjwang90 sjwang90 added area/snmp feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin labels Nov 24, 2020
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

@LeadingMoominExpert you need to add the description of the new option also to the sampleConfig variable.
Furthermore, I'm not sure if your testcase actually is suited to test the translate functionality as you specify the name in the tbl. How can you see if it is actually overwritten using the translation?

@srebhan srebhan self-assigned this Nov 25, 2020
@LeadingMoominExpert
Copy link
Contributor Author

@srebhan I modified the tests so that a field returns an OID value with cases of this value being translated and not translated with mocked snmptranslate command.

@LeadingMoominExpert
Copy link
Contributor Author

I also did not include the translate functionality in sampleConfig as it seems to only have descriptions of the plugin definitions and not table or field definitions.

const sampleConfig = `
## Agent addresses to retrieve values from.
## example: agents = ["udp://127.0.0.1:161"]
## agents = ["tcp://127.0.0.1:161"]
agents = ["udp://127.0.0.1:161"]
## Timeout for each request.
# timeout = "5s"
## SNMP version; can be 1, 2, or 3.
# version = 2
## Agent host tag; the tag used to reference the source host
# agent_host_tag = "agent_host"
## SNMP community string.
# community = "public"
## Number of retries to attempt.
# retries = 3
## The GETBULK max-repetitions parameter.
# max_repetitions = 10
## SNMPv3 authentication and encryption options.
##
## Security Name.
# sec_name = "myuser"
## Authentication protocol; one of "MD5", "SHA", or "".
# auth_protocol = "MD5"
## Authentication password.
# auth_password = "pass"
## Security Level; one of "noAuthNoPriv", "authNoPriv", or "authPriv".
# sec_level = "authNoPriv"
## Context Name.
# context_name = ""
## Privacy protocol used for encrypted messages; one of "DES", "AES" or "".
# priv_protocol = ""
## Privacy password used for encrypted messages.
# priv_password = ""
## Add fields and tables defining the variables you wish to collect. This
## example collects the system uptime and interface variables. Reference the
## full plugin documentation for configuration details.
`

Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

Fair enough. :-) Looks good.

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 26, 2020
@ssoroka ssoroka merged commit a7096c8 into influxdata:master Nov 26, 2020
@LeadingMoominExpert LeadingMoominExpert deleted the translate-snmp-field-values branch November 26, 2020 18:24
@Hipska
Copy link
Contributor

Hipska commented Nov 27, 2020

Does this also solve #6330? And could you give an example output with the function enabled? Thanks.

@ssoroka
Copy link
Contributor

ssoroka commented Nov 27, 2020

Looks like it doesn't solve it for integer fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/snmp feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable snmptranslate to field values
5 participants