Class: Net::SNMP::Agent
- Inherits:
-
Object
- Object
- Net::SNMP::Agent
- Extended by:
- Forwardable
- Includes:
- Debug
- Defined in:
- lib/net/snmp/agent/agent.rb
Overview
-
Manages the request/response cycle for incoming messages
+ Listens for incoming requests + Parses request packets into Message objects + Dispatches the messages to (sub) Agents + Serializes the response from the subagents and sends it to the caller
Instance Attribute Summary collapse
-
#listener ⇒ Object
Returns the value of attribute listener.
-
#providers ⇒ Object
Returns the value of attribute providers.
Instance Method Summary collapse
-
#initialize ⇒ Agent
constructor
A new instance of Agent.
- #provide(oid = :all, &block) ⇒ Object
Methods included from Debug
#debug, #error, #fatal, #info, #print_packet, #time, #warn
Constructor Details
Instance Attribute Details
#listener ⇒ Object
Returns the value of attribute listener.
13 14 15 |
# File 'lib/net/snmp/agent/agent.rb', line 13 def listener @listener end |
#providers ⇒ Object
Returns the value of attribute providers.
13 14 15 |
# File 'lib/net/snmp/agent/agent.rb', line 13 def providers @providers end |
Instance Method Details
#provide(oid = :all, &block) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/net/snmp/agent/agent.rb', line 22 def provide(oid = :all, &block) # Need a trailing dot on the oid so we can avoid # considering 1.3.22 a child of 1.3.2 oid = (oid.to_sym == :all || oid.end_with?('.')) ? oid : "#{oid}." provider = Provider.new(oid) provider.instance_eval(&block) # Providers are pushed onto the end of the provider queue. # When dispatching, this is searched in order for a match. # So, like exception handlers, you such specify providers # in order of most -> least specific oid. ('1.3.1' comes before '1.3') providers << provider end |