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 SNMP over TCP #5870

Merged
merged 4 commits into from
Nov 7, 2019
Merged

Support for SNMP over TCP #5870

merged 4 commits into from
Nov 7, 2019

Conversation

skyfmmf
Copy link
Contributor

@skyfmmf skyfmmf commented May 17, 2019

While SNMP is usually done over UDP, it is possible to transport it using TCP. This is specified in RFC 3430 and should be used when transferring lots of data.

This PR adds support for SNMP over TCP to telegraf. The heavy lifting is done by the gosnmp library. Therefore it was only necessary to set the transport protocol for the agents, that should be gathered via TCP. To use it, you have to configure an agent like this:

[[inputs.snmp]]
  agents = [ "tcp://1.2.3.4" ]

The notation of prefixing with tcp: has been taken from net-snmp which uses it for their command line tools like snmpbulkwalk.

Required for all PRs:

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

Gopkg.lock Outdated Show resolved Hide resolved
plugins/inputs/snmp/snmp.go Outdated Show resolved Hide resolved
@glinton glinton added area/snmp feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin labels May 17, 2019
@@ -488,6 +488,14 @@
revision = "636bf0302bc95575d69441b25a2603156ffdddf1"
version = "v1.1.1"

[[projects]]
digest = "1:530233672f656641b365f8efb38ed9fba80e420baff2ce87633813ab3755ed6d"
name = "github.com/golang/mock"
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this is a new dependency of gosnmp, maybe if it were generated into the gosnmp_test package we wouldn't need this testing dep? I'd like to have someone look into if this is possible before updating gosnmp.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand that you do not want to include this testing dep, but I am not sure how to fix this.

plugins/inputs/snmp/snmp.go Outdated Show resolved Hide resolved
plugins/inputs/snmp/snmp.go Outdated Show resolved Hide resolved
Gopkg.lock Outdated Show resolved Hide resolved
The new version of gosnmp does have support for SNMP over TCP.
Agents prefixed with 'tcp://' do now get their transport protocol set to
TCP. gosnmp handles all the details.
Add a new test to verify that agents prefixed with tcp: use the correct
transport protocol. As getConnection does the full connection setup, we
need a server listening on the port to allow the test to pass. This
server is therefore also set up in the test.  Also verify that the other
agents still use UDP.
@danielnelson
Copy link
Contributor

Sorry about stranding this PR for so long, while I'd still love the gomock dependency removed it's not enough to hold up this PR.

@danielnelson danielnelson merged commit 378c570 into influxdata:master Nov 7, 2019
@skyfmmf skyfmmf deleted the snmp-tcp branch February 14, 2020 10:04
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 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
Labels
area/snmp feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants