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

feat(inputs.snmp): Convert octet string with invalid data to hex #15439

Merged

Conversation

Hipska
Copy link
Contributor

@Hipska Hipska commented May 31, 2024

Summary

Some snmp data is binary encoded and displayed as HEX string with net-snmp tools (Hex-STRING: 84 C8 07 FF FD 38 54 C1). Currently Telegraf tries to interpret these bytes as string and thus resulting in non-printable characters: raw="����8T�".

This PR changes this so that they will be converted to HEX in the case of OctetString and containing not valid UTF8 characters, resulting in raw="84c807fffd3854c1". Similar fix has been done for inputs.snmp_trap: #14619.

Meanwhile I also added a new field conversion option so you can force to always convert the value to HEX string.

Checklist

  • No AI generated code was used in this PR

Related issues

related to #14619
resolves #12456
resolves #3716
resolves #3478

@telegraf-tiger telegraf-tiger bot added area/snmp feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels May 31, 2024
@Hipska Hipska marked this pull request as draft June 3, 2024 07:36
@Hipska Hipska force-pushed the feat/inputs/snmp_bytes_to_hex branch from 7b85c4f to 5c20bac Compare June 3, 2024 10:46
@Hipska Hipska marked this pull request as ready for review June 3, 2024 11:15
@Hipska

This comment was marked as outdated.

@srebhan srebhan self-assigned this Jun 3, 2024
@Hipska Hipska marked this pull request as draft June 3, 2024 20:34
@Hipska Hipska marked this pull request as ready for review June 4, 2024 07:59
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.

Thanks for your contribution @Hipska!

@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 Jun 4, 2024
@srebhan srebhan assigned powersj and DStrand1 and unassigned srebhan Jun 4, 2024
@powersj powersj merged commit c1bbce3 into influxdata:master Jun 4, 2024
24 of 26 checks passed
@github-actions github-actions bot added this to the v1.31.0 milestone Jun 4, 2024
@Hipska Hipska deleted the feat/inputs/snmp_bytes_to_hex branch June 4, 2024 15:12
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Jun 4, 2024

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 plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins 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
4 participants