Created
August 23, 2011 16:10
-
-
Save bjreath/1165678 to your computer and use it in GitHub Desktop.
Testing net-snmp gem in OS X Lion
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
/Users/bjreath/.rvm/gems/ruby-1.9.2-p290@issues/gems/ffi-1.0.9/lib/ffi/library.rb:147:in `attach_function': Function 'init_mib' not found in [libnetsnmp.dylib] (FFI::NotFoundError) | |
from /Users/bjreath/.rvm/gems/ruby-1.9.2-p290@issues/gems/nice-ffi-0.4/lib/nice-ffi/library.rb:122:in `attach_function' | |
from /Users/bjreath/.rvm/gems/ruby-1.9.2-p290@issues/gems/net-snmp-0.2.3/lib/net/snmp/wrapper.rb:349:in `<module:Wrapper>' | |
from /Users/bjreath/.rvm/gems/ruby-1.9.2-p290@issues/gems/net-snmp-0.2.3/lib/net/snmp/wrapper.rb:3:in `<module:SNMP>' | |
from /Users/bjreath/.rvm/gems/ruby-1.9.2-p290@issues/gems/net-snmp-0.2.3/lib/net/snmp/wrapper.rb:2:in `<module:Net>' | |
from /Users/bjreath/.rvm/gems/ruby-1.9.2-p290@issues/gems/net-snmp-0.2.3/lib/net/snmp/wrapper.rb:1:in `<top (required)>' | |
from /Users/bjreath/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
from /Users/bjreath/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' | |
from /Users/bjreath/.rvm/gems/ruby-1.9.2-p290@issues/gems/net-snmp-0.2.3/lib/net-snmp.rb:7:in `block in <top (required)>' | |
from /Users/bjreath/.rvm/gems/ruby-1.9.2-p290@issues/gems/net-snmp-0.2.3/lib/net-snmp.rb:6:in `each' | |
from /Users/bjreath/.rvm/gems/ruby-1.9.2-p290@issues/gems/net-snmp-0.2.3/lib/net-snmp.rb:6:in `<top (required)>' | |
from /Users/bjreath/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require' | |
from /Users/bjreath/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require' | |
from /Users/bjreath/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require' | |
from snmp_test.rb:2:in `<main>' |
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 'rubygems' | |
require 'net-snmp' | |
session = Net::SNMP::Session.open(:peername => "test.net-snmp.org", :community => "demopublic" ) | |
begin | |
pdu = session.get("sysDescr.0") | |
puts pdu.varbinds.first.value | |
rescue Net::SNMP::Error => e | |
puts e.message | |
end | |
session.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment