File: walk.rb

package info (click to toggle)
libsnmp-ruby 1.0.1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,428 kB
  • ctags: 573
  • sloc: ruby: 3,743; makefile: 40; sh: 23
file content (14 lines) | stat: -rw-r--r-- 312 bytes parent folder | download | duplicates (2)
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