Skip to content

Instantly share code, notes, and snippets.

@geezyx
Last active July 25, 2016 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geezyx/d587a31526c9c96af1234360b531972a to your computer and use it in GitHub Desktop.
Save geezyx/d587a31526c9c96af1234360b531972a to your computer and use it in GitHub Desktop.
require 'snmp'
require 'snmp4em'
OID_SYSTEM = "1.3.6.1.2.1.1"
OID_SYSNAME = "1.3.6.1.2.1.1.5.0"
OID_SYSLOCATION = "1.3.6.1.2.1.1.6.0"
EM.run {
snmp = SNMP4EM::Manager.new(:host => '10.6.57.29')
request = snmp.bulkwalk(OID_SYSTEM)
request.callback do |response|
response[OID_SYSTEM].each do |oid, value|
puts "#{oid} = #{value}"
end
end
request.errback do |error|
puts "BULK-WALK got error #{error}"
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment