Ubuntu and SNMP MIBs

Just a quick note: if you’re trying to run something that queries a specific MIB like:
snmpwalk -v1 -c public ${host} system

and you get an error like:
Unknown Object Identifier (Sub-id not found: (top) -> system)

This is because MIBs are not “free”, so Ubuntu disables them by default.

To get them back, install the MIBS using 
# apt-get install snmp-mibs-downloader

Then go comment out the mibs : line in /etc/snmp/snmp.conf (it’s line 4 as of this post). Now run your query again and things should be better.

playing with ruby

i started playing around with ruby recently.
one of the first things i figured i’d do is muck about with sockets.
it turns out that’s brain dead easy with ruby, which i was happy to discover.
here’s a quick and dirty whois client i whipped up as a way to learn the syntax etc.

require "socket"

rr = Array.new
whoisrv = "whois.arin.net"
port = "43"
qry = "208.105.198.137"

s = TCPSocket.open(whoisrv, port)
s.puts(qry)
while rr = s.gets
   puts rr
end
s.close