Getting SNMP data in variable instead of using puts

  • Thread starter jackster the jackle
  • Start date
J

jackster the jackle

I'm trying to access my variable directly here rather than using puts to
print it out. Can anyone tell me the easiest way to access it from the
variable?

ipadd = ARGV[0]
columns = ["ifDescr"]
SNMP::Manager.open:)Host => ipadd, :Community => "877pricelineHOBO" ) do
|m|
m.walk(columns) { |row| puts row.join("\t") }
end

thanks

jackster
 
T

Todd Benson

I'm trying to access my variable directly here rather than using puts to
print it out. Can anyone tell me the easiest way to access it from the
variable?

Can't test right now because I don't have a device/system using SNMP
handy, but, thinking it's simply a scoping issue...
ipadd = ARGV[0]
columns = ["ifDescr"]

ifDescr = []
SNMP::Manager.open:)Host => ipadd, :Community => "877pricelineHOBO" ) do
|m|

m.walk(columns) { |row| ifDescr << row.join("\t") }

puts ifDescr


Todd
 
J

jackster the jackle

Thanks alot Todd...I'm in good shape...

jackster



Todd said:
I'm trying to access my variable directly here rather than using puts to
print it out. Can anyone tell me the easiest way to access it from the
variable?

Can't test right now because I don't have a device/system using SNMP
handy, but, thinking it's simply a scoping issue...
ipadd = ARGV[0]
columns = ["ifDescr"]

ifDescr = []
SNMP::Manager.open:)Host => ipadd, :Community => "877pricelineHOBO" ) do
|m|

m.walk(columns) { |row| ifDescr << row.join("\t") }

puts ifDescr


Todd
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top