Sha256: 1b877fd68cc407b5cab8eaaa2077cb95c6fe06154a55d23a9dc987e53a662a0c

Contents?: true

Size: 399 Bytes

Versions: 7

Compression:

Stored size: 399 Bytes

Contents

require 'snmp'
include SNMP

host = ARGV[0] || 'localhost'

manager = Manager.new(:Host => host, :Port => 161)
ifTable = ObjectId.new("1.3.6.1.2.1.2.2")
next_oid = ifTable
while next_oid.subtree_of?(ifTable)
  response = manager.get_next(next_oid)
  varbind = response.varbind_list.first
  next_oid = varbind.name
  puts "#{varbind.name.to_s}  #{varbind.value.to_s}  #{varbind.value.asn1_type}"
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
snmp-1.3.2 examples/iftable.rb
snmp-1.3.1 examples/iftable.rb
snmp-1.3.0 examples/iftable.rb
snmp-1.2.0 examples/iftable.rb
snmp-1.1.1 examples/iftable.rb
snmp-1.1.0 examples/iftable.rb
snmp-1.0.4 examples/iftable.rb