-
Notifications
You must be signed in to change notification settings - Fork 22
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 tcp transport protocol #8
Conversation
lib/logstash/inputs/snmp.rb
Outdated
@@ -76,16 +76,20 @@ def register | |||
|
|||
host_details = host_name.match(HOST_REGEX) | |||
raise(LogStash::ConfigurationError, "invalid format for host option '#{host_name}'") unless host_details | |||
raise(LogStash::ConfigurationError, "only the udp protocol is supported for now") unless host_details[:host_protocol].to_s =~ /udp/i | |||
raise(LogStash::ConfigurationError, "only udp & tcp protocols are supported") unless host_details[:host_protocol].to_s =~ /^(?:udp|tcp)$/i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like we do in the previous raise
, here we should include the host string we're validating to help the user figure out where the mistake was.
@@ -54,13 +54,15 @@ | |||
{"get" => ["1.0"], "hosts" => [{"host" => "udp:localhost/161"}]}, | |||
{"get" => ["1.0"], "hosts" => [{"host" => "udp:127.0.0.1/112345"}]}, | |||
{"get" => ["1.0"], "hosts" => [{"host" => "udp:127.0.0.1/161", "community" => "public"}]}, | |||
{"get" => ["1.0"], "hosts" => [{"host" => "tcp:127.0.0.1/112345"}]}, | |||
{"get" => ["1.0"], "hosts" => [{"host" => "tcp:127.0.0.1/161", "community" => "public"}]}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should't this be 1161?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't have to be - note that we are only verifying the format here but in any case, the port number can be any number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, I was just aiming at consistency in the examples that reference 1161 for tcp in two other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
add host info in exception
Thanks @jsvd ! will be pushing 0.1.0.beta3 shortly. |
Add support for tcp transport protocol.
I locally tested this both for udp and tcp and both are working. We are lacking test/spec coverage for this and I will followup with an initial spec for the client.