File: get.rb

package info (click to toggle)
libsnmp-ruby 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze, wheezy
  • size: 1,420 kB
  • ctags: 581
  • sloc: ruby: 3,817; makefile: 41
file content (7 lines) | stat: -rw-r--r-- 200 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
require 'snmp'

host = ARGV[0] || 'localhost'

manager = SNMP::Manager.new(:Host => host, :Port => 161)
response = manager.get(["sysDescr.0", "sysName.0"])
response.each_varbind { |vb| puts vb.to_s }