class SNMP::Manager

This class provides a manager for interacting with a single SNMP agent.

Example

require 'snmp'

manager = SNMP::Manager.new(:host => 'localhost', :port => 1061)
response = manager.get(["1.3.6.1.2.1.1.1.0", "1.3.6.1.2.1.1.2.0"])
response.each_varbind {|vb| puts vb.inspect}
manager.close

Symbolic Object Names

Symbolic names for SNMP object IDs can be used as parameters to the APIs in this class if the MIB modules are imported and the names of the MIBs are included in the MibModules configuration parameter.

See MIB.varbind_list for a description of valid parameter formats.

The following modules are loaded by default: “SNMPv2-SMI”, “SNMPv2-MIB”, “IF-MIB”, “IP-MIB”, “TCP-MIB”, “UDP-MIB”. All of the current IETF MIBs have been imported and are available for loading.

Additional modules may be imported using the MIB class. The current implementation of the importing code requires that the external ‘smidump’ tool is available in your PATH. This tool can be obtained from the libsmi website at www.ibr.cs.tu-bs.de/projects/libsmi/ .

Example

Do this once:

SNMP::MIB.import_module(MY_MODULE_FILENAME, MIB_OUTPUT_DIR)

Include your module in MibModules each time you create a Manager:

SNMP::Manager.new(:host => 'localhost', :mib_dir => MIB_OUTPUT_DIR,
                  :mib_modules => ["MY-MODULE-MIB", "SNMPv2-MIB", ...])