Class SNMP::MIB
In: lib/snmp/mib.rb
Parent: Object

Methods

Classes and Modules

Class SNMP::MIB::ModuleNotLoadedError

Constants

MODULE_EXT = 'yaml'

Public Class methods

Import an SMIv2 MIB file for later loading. A module only needs to be installed once.

  module_file - the filename of the module to be imported
  mib_dir - the output directory for the serialized MIB data

NOTE: This implementation requires that the ‘smidump’ tool is available in the PATH. This tool can be obtained from the libsmi website at http://www.ibr.cs.tu-bs.de/projects/libsmi/ .

ALSO NOTE: The file format in future releases is subject to change. For now, it is a simple YAML hash with the MIB symbol as the key and the OID as the value. These files could be generated manually if ‘smidump’ is not available.

Here is an example of the contents of an output file:

  ---
  ipDefaultTTL: 1.3.6.1.2.1.4.2
  ipForwDatagrams: 1.3.6.1.2.1.4.6
  ipOutRequests: 1.3.6.1.2.1.4.10
  ipOutNoRoutes: 1.3.6.1.2.1.4.12
  ipReasmTimeout: 1.3.6.1.2.1.4.13
  icmpInDestUnreachs: 1.3.6.1.2.1.5.3

The MIB.import_module method is only supported if the external ‘smidump’ tool is available. This method returns true if a known version of the tool is available.

Returns a list of MIB modules that have been imported. All of the current IETF MIBs should be available from the default MIB directory.

If a regex is provided, then the module names are matched against that pattern.

Returns the full filename of the imported MIB file for the given module name.

Public Instance methods

Loads a module into this MIB. The module must be imported before it can be loaded. See MIB.import_module .

Returns an ObjectId for the given name. Names are in the format <ModuleName>::<NodeName>.<Index> with ModuleName and Index being optional.

Returns a VarBind object for the given name and value. The name can be a String, ObjectId, or anything that responds to :to_varbind.

String names are in the format <ModuleName>::<NodeName>.<Index> with ModuleName and Index being optional.

Returns a VarBindList for the provided list of objects. If a string is provided it is interpretted as a symbolic OID.

This method accepts many different kinds of objects:

  • single string object IDs e.g. "1.3.6.1" or "IF-MIB::ifTable.1.1"
  • single ObjectId
  • list of string object IDs
  • list of ObjectIds
  • list of VarBinds

[Validate]