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

fix(inputs.snmp_trap): Copy GoSNMP global defaults to prevent side-effects #13542

Merged
merged 12 commits into from
Jul 5, 2023

Conversation

mark-chandler
Copy link
Contributor

Required for all PRs

resolves #13414

Setting up the SNMP parameters using gosnmp.Default seems to be using the same pointer for every instance.
Replace this with code that creates a separate variable each time copied from gosnmp.Default, then passes the pointer to that variable into the listener.Params.

Bump version of gosnmp package to a more recent commit.

Add some extra logging for gosnmp.

@mark-chandler mark-chandler changed the title fix (plugins:inputs:snmp_trap) GoSNMP global defaults fix fix (plugins:inputs:snmp_trap): GoSNMP global defaults fix Jul 4, 2023
@mark-chandler mark-chandler changed the title fix (plugins:inputs:snmp_trap): GoSNMP global defaults fix fix (inputs.snmp_trap): GoSNMP global defaults fix Jul 4, 2023
@mark-chandler mark-chandler changed the title fix (inputs.snmp_trap): GoSNMP global defaults fix fix(inputs.snmp_trap): GoSNMP global defaults fix Jul 4, 2023
@telegraf-tiger
Copy link
Contributor

telegraf-tiger bot commented Jul 4, 2023

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.

Nice fix @mark-chandler! Thanks for your contribution!

@srebhan srebhan changed the title fix(inputs.snmp_trap): GoSNMP global defaults fix fix(inputs.snmp_trap): Copy GoSNMP global defaults to prevent side-effects Jul 4, 2023
@srebhan srebhan added area/snmp fix pr to fix corresponding bug ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jul 4, 2023
@mark-chandler
Copy link
Contributor Author

Nice fix @mark-chandler! Thanks for your contribution!

No worries. Always nice to give back to a great project.
@bramblek1 is a Go developer and contributed the main fix. I'm not a Go developer and the tests that I've added are a copy/paste from the existing tests with some mods for multiple configs. That part might need the closest look as I've made educated guesses on how it should work.

@powersj powersj merged commit ae16353 into influxdata:master Jul 5, 2023
powersj pushed a commit to powersj/telegraf that referenced this pull request Jul 5, 2023
powersj pushed a commit that referenced this pull request Jul 10, 2023
@srebhan srebhan added this to the v1.27.2 milestone Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/snmp fix pr to fix corresponding bug 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
Development

Successfully merging this pull request may close these issues.

input: snmp_trap: only one v3 config can be used
5 participants