Class: Net::SNMP::Agent
- Inherits:
-
Object
- Object
- Net::SNMP::Agent
- Extended by:
- Forwardable
- Includes:
- Debug
- Defined in:
- lib/net/snmp/agent/agent.rb
Overview
Agents delegate messages from the Net::SNMP::Listener to providers, which supply the actual responses to the varbinds in the request. See Net::SNMP::ProviderDsl
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
This method is called with a block to define a provider for some subtree of the MIB.
Methods included from Debug
Constructor Details
Instance Attribute Details
#listener ⇒ Object
Returns the value of attribute listener.
11 12 13 |
# File 'lib/net/snmp/agent/agent.rb', line 11 def listener @listener end |
#providers ⇒ Object
Returns the value of attribute providers.
11 12 13 |
# File 'lib/net/snmp/agent/agent.rb', line 11 def providers @providers end |
Instance Method Details
#provide(oid = :all, &block) ⇒ Object
This method is called with a block to define a provider for some subtree of the MIB. When a request comes in with varbinds in that providers subtree, the provider’s handlers will be called to generate the varbind to send back in the response PDU.
Arguments
-
oid: The root OID of the MIB subtree this provider is responsible for.
-
&block: A block, to be instance_evaled on the new Provider.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/net/snmp/agent/agent.rb', line 29 def provide(oid = :all, &block) 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 |