MIBBLER – A wrapper for MIBBLE.jar www.mibble.org¶ ↑
MIBBLER is a Jruby wrapper around mibble.jar. It allows for parsing a mib, loading other mibs, and is meant to be used with Mark Cotner’s SNMP4J. It has one class, Loaded_mibs. Accroding to the Mibble documentation MibLoader is not thread safe, therefore, create one instance and use that instance throughout your code.
-
Use Ruby scripts to take advantage of Mibble’s compile Java code.
-
Parse a mib to get OID’s matched with their human readable values.
-
Load more mibs. By default it uses /usr/share/mibs but you may change the directory.
The example is a modified example from SNMP4JR
#!/usr/bin/env jruby
require ‘rubygems’ require ‘SNMP4JR’ require ‘MIBBLER’
# This defaults to version 2c bulkwalk(most efficient method) unless you specify version1
# Create an instance of Loaded_mibs to manipulate the Mibs. Public methods are: parse_mib, load_mib, and get_oid
mymibs = Loaded_mibs.new oids = mymibs.get_oid(‘dot1dBasePort’, ‘sysDescr’)
target = SNMPTarget.new(:host => ‘<switch-ip-address>’, :community => ‘public’,
:version => SNMP4JR::MP::Version2c)
target.max_repetitions = 1 target.non_repeaters = 2
target.get_bulk(oids).each do |vb| puts vb.to_s
end