Snmp with s2nmp or rubyonrails

Hi all,

I'm using Ruby about 3-4 mounts. Now, i want to make a project about network devices with SNMP.

But, until this time; i haven't used rubyonrails yet.

Yesterday (i hope) i've installed rubyonrails. And i made some steps like that:

# rails /home/student/new_directory

and i copy a script in it like:

···

------------------------------

#!/usr/bin/ruby
require 'snmp'

ifTable_columns =
     ["ifIndex", "ifDescr", "ifInOctets", "ifOutOctets"]
     SNMP::Manager.open(:Host => 'localhost') do |manager|
       manager.walk(ifTable_columns) do |row|
           row.each { |vb| print "\t#{vb.value}" }
               puts
                 end
                 end

-----------------------------

But it tells me;
`require': no such file to load -- snmp (LoadError)

I tried to fix this but i couldn't do anything.

So i gave up to do it with rubyonrails; and installed s2nmp (http://members.at.infoseek.co.jp/m6809/ex_get.html).

This time; i tried to run this script like: #ruby example.rb 10.0.0.2
(i couldn't find an ip address to make excercises so i tried to use my adsl router: 10.0.0.2)

------------------------------
# Usage: ruby getsysdsc.rb
#
#
require 'socket'
require 's2nmp'

host=ARGV.shift

s=SNMP.new(host)
sts=s.get("public",["1.3.6.1.2.1.1.1.0"])
if sts then
   p s.vars
   else
     print "TIMEOUT."
     end

------------------------------

It tells me:
-------------------
/usr/lib/ruby/1.8/s2nmp.rb:267:in `recv': Connection refused - recvfrom(2) (Errno::ECONNREFUSED)
         from /usr/lib/ruby/1.8/s2nmp.rb:267:in `get'
         from example.rb:10
----------------------

Can you give me any ideas or advices? Plus; i haven't decide to make it with s2nmp or rubyonrails.

Best Regards,

Esravan Rolda.

---------------------------------
Yahoo! kullaniyor musunuz?
Istenmeyen postadan biktiniz mi? Istenmeyen postadan en iyi korunma Yahoo! Posta’da
http://tr.mail.yahoo.com