How to handle timeouts in SNMP::Manager walks


Maybe a simple thing, but I can’t get a clear google answer.

I’m using SNMP::Manager to walk a switch for mac-adresses. When some
switch isn’t there, i get a timeout error. I want to handle this
exception. What is the preferred way to do that? My code is something
like this:

dot1dTp_columns = [“dot1dTpFdbAddress”, “dot1dTpFdbPort”,
“dot1dTpFdbStatus”] => “#{device_name}”,
:Community => ‘*****’,
:MibModules => [“BRIDGE-MIB”, “SNMPv2-MIB”,“IF-MIB”,
) do |manager|

manager.walk(dot1dTp_columns) do |address,port,status|
  mac     = address.value.unpack("H2H2H2H2H2H2").join(":").to_s
  port    = port.value.to_s
  status  = status.value.to_s

[ insert results in db ]