File: walk.rb

package info (click to toggle)
ruby-snmp 1.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,860 kB
  • sloc: ruby: 1,791; makefile: 9
file content (14 lines) | stat: -rw-r--r-- 301 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'snmp'

host = ARGV[0] || 'localhost'

SNMP::Manager.open(:Host => "localhost") do |manager|
  manager.walk("ifTable") { |vb| puts vb }
end


SNMP::Manager.open(:Host => host) do |manager|
  manager.walk(["ifIndex", "ifDescr"]) do |ifIndex, ifDescr|
    puts "#{ifIndex} #{ifDescr}"
  end
end