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

NullpointerException #34

Open
BrechtClaeys opened this issue Jan 28, 2019 · 3 comments
Open

NullpointerException #34

BrechtClaeys opened this issue Jan 28, 2019 · 3 comments
Labels
bug Something isn't working plugin:input-snmp

Comments

@BrechtClaeys
Copy link

Hi,
When trying out one of the example configurations in the documentation, I keep getting errors. when running logstash.

This is the used configuration in my input:`

input{
  snmp {
    get => ["1.3.6.1.2.1.1.1.0"]
    hosts => [{host => "udp: 10.2.1.8/161" community => "public"}]
  }
}

I always get the following error:

[2019-01-28T10:50:52,026][ERROR][logstash.inputs.snmp     ] error invoking get operation on  10.2.1.7 for OIDs: ["1.3.6.1.2.1.1.1.0"], ignoring {:exception=>java.lang.NullPointerException, :backtrace=>["org.snmp4j.MessageDispatcherImpl.getTransport(org/snmp4j/MessageDispatcherImpl.java:225)", "org.snmp4j.MessageDispatcherImpl.sendPdu(org/snmp4j/MessageDispatcherImpl.java:446)", "org.snmp4j.Snmp.sendMessage(org/snmp4j/Snmp.java:1089)", "org.snmp4j.Snmp.send(org/snmp4j/Snmp.java:983)", "org.snmp4j.Snmp.send(org/snmp4j/Snmp.java:963)", "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)", "org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:483)", "org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:338)", "usr.share.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_input_minus_snmp_minus_1_dot_0_dot_1.lib.logstash.inputs.snmp.base_client.get(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-snmp-1.0.1/lib/logstash/inputs/snmp/base_client.rb:51)", "usr.share.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_input_minus_snmp_minus_1_dot_0_dot_1.lib.logstash.inputs.snmp.block in run(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-snmp-1.0.1/lib/logstash/inputs/snmp.rb:160)", "org.jruby.RubyArray.each(org/jruby/RubyArray.java:1734)", "usr.share.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_input_minus_snmp_minus_1_dot_0_dot_1.lib.logstash.inputs.snmp.run(/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-snmp-1.0.1/lib/logstash/inputs/snmp.rb:156)", "usr.share.logstash.vendor.bundle.jruby.$2_dot_3_dot_0.gems.logstash_minus_input_minus_snmp_minus_1_dot_0_dot_1.lib.logstash.inputs.snmp.RUBY$method$run$0$__VARARGS__(usr/share/logstash/vendor/bundle/jruby/$2_dot_3_dot_0/gems/logstash_minus_input_minus_snmp_minus_1_dot_0_dot_1/lib/logstash/inputs//usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-snmp-1.0.1/lib/logstash/inputs/snmp.rb)", "usr.share.logstash.logstash_minus_core.lib.logstash.pipeline.inputworker(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:409)", "usr.share.logstash.logstash_minus_core.lib.logstash.pipeline.RUBY$method$inputworker$0$__VARARGS__(usr/share/logstash/logstash_minus_core/lib/logstash//usr/share/logstash/logstash-core/lib/logstash/pipeline.rb)", "usr.share.logstash.logstash_minus_core.lib.logstash.pipeline.block in start_input(/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:403)", "org.jruby.RubyProc.call(org/jruby/RubyProc.java:289)", "org.jruby.RubyProc.call(org/jruby/RubyProc.java:246)", "java.lang.Thread.run(java/lang/Thread.java:748)"]}

Any idea what causes this?
Thanks in advance.

@axrayn
Copy link

axrayn commented Jan 28, 2019

Hi @BrechtClaeys

Looks like you have an extra space in the host address after the ":"
e.g. udp: 10.2.1.8/161 instead of udp:10.2.1.8/161

@colinsurprenant Looks like we may need to update the HOST_REGEX to raise a config error on whitespace or other invalid characters in the host address.

Something like: /^(?<host_protocol>udp|tcp):(?<host_address>[a-z\-\_\.\d]+)\/(?<host_port>\d+)$/i ?

@BrechtClaeys
Copy link
Author

Oh wow, feeling kinda dumb now :)
Thanks for helping me out, would indeed be good to have a clearer error message there.

@colinsurprenant
Copy link

Thanks @BrechtClaeys @axrayn - yeah, not a great handling and error here.
I think we should just accept whitespaces to start with and yeah, make sure we don't trigger a NPE from invalid input :P

@colinsurprenant colinsurprenant added the bug Something isn't working label Mar 28, 2019
@colinsurprenant colinsurprenant self-assigned this Jul 30, 2019
@edmocosta edmocosta transferred this issue from logstash-plugins/logstash-input-snmp May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin:input-snmp
Projects
None yet
Development

No branches or pull requests

4 participants