Class: Fluent::SnmpTrapInput
- Inherits:
-
Input
- Object
- Input
- Fluent::SnmpTrapInput
- Defined in:
- lib/fluent/plugin/in_snmptrap.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
-
#initialize ⇒ SnmpTrapInput
constructor
A new instance of SnmpTrapInput.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ SnmpTrapInput
Returns a new instance of SnmpTrapInput.
5 6 7 8 |
# File 'lib/fluent/plugin/in_snmptrap.rb', line 5 def initialize super require 'snmp' end |
Instance Method Details
#configure(conf) ⇒ Object
15 16 17 |
# File 'lib/fluent/plugin/in_snmptrap.rb', line 15 def configure(conf) super end |
#shutdown ⇒ Object
33 34 35 |
# File 'lib/fluent/plugin/in_snmptrap.rb', line 33 def shutdown m.exit end |
#start ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fluent/plugin/in_snmptrap.rb', line 19 def start super m = SNMP::TrapListener.new(:Host => @host,:Port => @port) do |manager| manager.on_trap_default do |trap| tag = @tag = Engine.now record = {"value"=> trap.inspect.to_json,"tags"=>{"type"=>"alert","host"=>trap.source_ip}} Engine.emit(tag, , record) end end trap("INT") { m.exit } m.join end |