Class: LogStash::Inputs::Snmp4JTrap
- Inherits:
-
Base
- Object
- Base
- LogStash::Inputs::Snmp4JTrap
- Defined in:
- lib/logstash/inputs/snmp4jtrap.rb
Overview
Read snmp trap messages as events with optional custom MIB support.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Snmp4JTrap
constructor
A new instance of Snmp4JTrap.
-
#register ⇒ Object
def initialize.
- #run(output_queue) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(*args) ⇒ Snmp4JTrap
Returns a new instance of Snmp4JTrap.
26 27 28 |
# File 'lib/logstash/inputs/snmp4jtrap.rb', line 26 def initialize(*args) super(*args) end |
Instance Method Details
#register ⇒ Object
def initialize
30 31 32 33 34 |
# File 'lib/logstash/inputs/snmp4jtrap.rb', line 30 def register require 'snmp4jr' @snmptrap = nil load_mib_manager end |
#run(output_queue) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/logstash/inputs/snmp4jtrap.rb', line 36 def run(output_queue) begin snmptrap_listener(output_queue) rescue => e @logger.warn('SNMP4J Trap listener died', exception: e, backtrace: e.backtrace) Stud.stoppable_sleep(5) { stop? } retry if !stop? end end |
#stop ⇒ Object
46 47 48 49 |
# File 'lib/logstash/inputs/snmp4jtrap.rb', line 46 def stop @snmptrap.close if @snmptrap @snmptrap = nil end |