How to handle timeouts in SNMP::Manager walks

H

Henk Van Lingen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Need help to decode snmp string 2
snmp error 0
SNMP trap forwarding. 0
SNMP oid error 1
Working with SNMP 7
snmp help needed 0
Getting SNMP data in variable instead of using puts 2
ActiveRecord help 0

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top