snmp with s2nmp or rubyonrails

L

lala ksakja

--0-529774628-1133939278=:95576
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi all,
=20
I'm using Ruby about 3-4 mounts. Now, i want to make a project about net=
work devices with SNMP.
=20
But, until this time; i haven't used rubyonrails yet.=20
=20
Yesterday (i hope) i've installed rubyonrails. And i made some steps lik=
e that:
=20
# rails /home/student/new_directory
=20
and i copy a script in it like:
=20
------------------------------
=20
#!/usr/bin/ruby
require 'snmp'
=20
ifTable_columns =3D
["ifIndex", "ifDescr", "ifInOctets", "ifOutOctets"]
SNMP::Manager.open:)Host =3D> 'localhost') do |manager|
manager.walk(ifTable_columns) do |row|
row.each { |vb| print "\t#{vb.value}" }
puts
end
end
=20
-----------------------------
=20
=20
But it tells me;
`require': no such file to load -- snmp (LoadError)
=20
I tried to fix this but i couldn't do anything.
=20
So i gave up to do it with rubyonrails; and installed s2nmp (http://memb=
ers.at.infoseek.co.jp/m6809/ex_get.html).
=20
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 a=
dsl router: 10.0.0.2)
=20
=20
------------------------------
# Usage: ruby getsysdsc.rb
#
#
require 'socket'
require 's2nmp'
=20
host=3DARGV.shift
=20
s=3DSNMP.new(host)
sts=3Ds.get("public",["1.3.6.1.2.1.1.1.0"])
if sts then
p s.vars
else
print "TIMEOUT."
end
=20
=20
------------------------------
=20
=20
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
----------------------
=20
=20
Can you give me any ideas or advices? Plus; i haven't decide to make it =
with s2nmp or rubyonrails.
=20
Best Regards,
=20
Esravan Rolda.
=20

=09
---------------------------------
Yahoo! kullaniyor musunuz?
Istenmeyen postadan biktiniz mi? Istenmeyen postadan en iyi korunma Yahoo=
! Posta=E2=80=99da
http://tr.mail.yahoo.com
--0-529774628-1133939278=:95576--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top