How to handle timeouts in SNMP::Manager walks

Hi,

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”]
SNMP::Manager.open(:Host => “#{device_name}”,
:Community => ‘*****’,
:MibModules => [“BRIDGE-MIB”, “SNMPv2-MIB”,“IF-MIB”,
“SNMPv2-SMI”]
) 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 ]

end

end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs