Last active
July 25, 2016 13:54
-
-
Save geezyx/d587a31526c9c96af1234360b531972a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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