Class: Net::SNMP::TrapHandler
- Inherits:
-
Object
- Object
- Net::SNMP::TrapHandler
- Extended by:
- Forwardable
- Includes:
- Debug
- Defined in:
- lib/net/snmp/trap_handler/trap_handler.rb
Instance Attribute Summary collapse
-
#listener ⇒ Object
Returns the value of attribute listener.
-
#message ⇒ Object
Returns the value of attribute message.
-
#pdu ⇒ Object
Returns the value of attribute pdu.
-
#v1_handler ⇒ Object
Returns the value of attribute v1_handler.
-
#v2_handler ⇒ Object
Returns the value of attribute v2_handler.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ TrapHandler
constructor
A new instance of TrapHandler.
Methods included from Debug
#debug, #error, #fatal, #info, #print_packet, #time, #warn
Constructor Details
#initialize(&block) ⇒ TrapHandler
Returns a new instance of TrapHandler.
13 14 15 16 17 |
# File 'lib/net/snmp/trap_handler/trap_handler.rb', line 13 def initialize(&block) @listener = Net::SNMP::Listener.new @listener.(&method(:process_trap)) self.instance_eval(&block) end |
Instance Attribute Details
#listener ⇒ Object
Returns the value of attribute listener.
6 7 8 |
# File 'lib/net/snmp/trap_handler/trap_handler.rb', line 6 def listener @listener end |
#message ⇒ Object
Returns the value of attribute message.
6 7 8 |
# File 'lib/net/snmp/trap_handler/trap_handler.rb', line 6 def @message end |
#pdu ⇒ Object
Returns the value of attribute pdu.
6 7 8 |
# File 'lib/net/snmp/trap_handler/trap_handler.rb', line 6 def pdu @pdu end |
#v1_handler ⇒ Object
Returns the value of attribute v1_handler.
6 7 8 |
# File 'lib/net/snmp/trap_handler/trap_handler.rb', line 6 def v1_handler @v1_handler end |
#v2_handler ⇒ Object
Returns the value of attribute v2_handler.
6 7 8 |
# File 'lib/net/snmp/trap_handler/trap_handler.rb', line 6 def v2_handler @v2_handler end |
Class Method Details
.listen(port = 162, interval = 2, max_packet_size = 65_000, &block) ⇒ Object
9 10 11 |
# File 'lib/net/snmp/trap_handler/trap_handler.rb', line 9 def self.listen(port = 162, interval = 2, max_packet_size = 65_000, &block) self.new end |