logstash-plugins / logstash-input-snmp

Apache License 2.0
17 stars 22 forks source link

Can this plugin be extended to receive snmp traps? #44

Closed tchenscw closed 5 years ago

tchenscw commented 5 years ago

Hi, Since snmpv3 support for snmptrap plugin has been opened for a long time, I was wondering whether there is a way to extend this plugin to receive snmp traps via v3 protocol.

edperry commented 5 years ago

You should look at https://www.elastic.co/guide/en/logstash/current/plugins-inputs-snmptrap.html

tchenscw commented 5 years ago

Hi edperry, I did. But this issues https://github.com/logstash-plugins/logstash-integration-snmp/issues/49 remains opened since 2015. Even longer for the ruby support of snmpv3. My angle is since snmp input plugin act similar as snmp manager, extending it with trap receiver would not be as far fetched. Any thoughts?

Thanks

edperry commented 5 years ago

I am not the repo manager, but it seems the reason the logstash-input-snmptrap did not implement is because the "gem" snmp library does not support it. I don't know if both are using the same library or not. This a bet would be that they are.

As for adding it to this project, IMO it would not be appropriate, since this is a "Polling" plugin and receiving SNMP traps is a Passive operation (Listening) those are completely 2 different functions and again IMO should be 2 seperate functions like logstash-input-file and logstash-input-tcp similar functionality but different logic and behavior.

but again, these are only my thoughts based on my observation of the Logstash community over the years. I would defer to any of the repo-admins to their opinions.

axrayn commented 5 years ago

@tchenscw Pretty much as @edperry says. The logstash-input-snmptrap is a purely ruby implementation using the http://github.com/hallidave/ruby-snmp gem for the SNMP parts whereas this plugin is JRuby using the SNMP4J Java library.

The problem arises because (last I checked) the author of the ruby gem said back in 2011 that he didn't have the time or motivation to add it (https://github.com/hallidave/ruby-snmp/issues/2#issuecomment-832274) in writing v3 support.

As for including SNMP trap support in this plugin, whilst @colinsurprenant does have it listed in the 'Post GA' plans in the META issue logstash-plugins/logstash-input-snmptrap#2, I'd be inclined to agree with @edperry that this plugin is more designed as a poller not a listener.

colinsurprenant commented 5 years ago

@tchenscw @edperry @axrayn thanks for your input here!

axrayn commented 5 years ago

Ironically, after I posted, I started looking at whether I could rewrite the snmptrap plugin from scratch using the SNMP4J library. I stopped after the third or fourth "I'll just borrow this function from the snmp plugin...." and had realised the craziness. :)

colinsurprenant commented 5 years ago

@axrayn, any PRs for that are welcome 😄 I myself likely won't be able to work on that in the next few weeks.

axrayn commented 5 years ago

@colinsurprenant I'm still struggling with tables, that's a higher priority for our needs at work. Will definitely see what I can do though.

colinsurprenant commented 5 years ago

@axrayn finding the best way to represent snmp tables is definitely high on my priorities too. I'd love to hear your thoughts, let's open a separate "design" issue about this.

colinsurprenant commented 5 years ago

@axrayn opened #45 for this.

tchenscw commented 5 years ago

@colinsurprenant @axrayn Thanks for the explanation. Glad to hear there is a plan to support trap receiver. Our group has some expertise in Java but not in Ruby. We will follow closely and see if there's anything we can help.

colinsurprenant commented 5 years ago

Issue #46 discusses trap handling. Closing.