Class: Net::SNMP::V2TrapDsl
- Inherits:
-
Object
- Object
- Net::SNMP::V2TrapDsl
show all
- Includes:
- Debug
- Defined in:
- lib/net/snmp/trap_handler/v2_trap_dsl.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Debug
#debug, #error, #fatal, #info, #print_packet, #time, #warn
Constructor Details
#initialize(message) ⇒ V2TrapDsl
Returns a new instance of V2TrapDsl.
7
8
9
|
# File 'lib/net/snmp/trap_handler/v2_trap_dsl.rb', line 7
def initialize(message)
@message = message
end
|
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
5
6
7
|
# File 'lib/net/snmp/trap_handler/v2_trap_dsl.rb', line 5
def message
@message
end
|
Instance Method Details
#oid ⇒ Object
Also known as:
trap_oid
15
16
17
18
19
20
21
22
|
# File 'lib/net/snmp/trap_handler/v2_trap_dsl.rb', line 15
def oid
vb = varbinds.find{|vb| vb.oid.to_s == Constants::OID_SNMP_TRAP_OID}
if vb
vb.value
else
nil
end
end
|
#pdu ⇒ Object
11
12
13
|
# File 'lib/net/snmp/trap_handler/v2_trap_dsl.rb', line 11
def pdu
message.pdu
end
|
#uptime ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/net/snmp/trap_handler/v2_trap_dsl.rb', line 25
def uptime
vb = varbinds.find{|vb| vb.oid.to_s == Constants::OID_SYS_UP_TIME_INSTANCE}
if vb
vb.value
else
nil
end
end
|
#varbinds ⇒ Object
34
35
36
|
# File 'lib/net/snmp/trap_handler/v2_trap_dsl.rb', line 34
def varbinds
pdu.varbinds
end
|