SNMP agent library?

M

Marcus Bristav

I need to write an SNMP agent (raise traps and expose MIBs). Is there
a nice Ruby open source library to help with this? I saw Ruby SNMP but
that only seems to handle the management side of it. Please also let
me if I'm wrong about that.

Regards,

Marcus
 
M

Marcus Bristav

Hi Francis,

If you don't find anything appropriate that already exists, let me know. I
wrote a SNMP agent on top of EventMachine (except for traps, which in my
application are verboten) for managing an access-control appliance. It
exposes a handful of standard MIBs and of course it's extensible.

I put some of the necessary SNMP protocol support in the Net::LDAP library,
so it can use the BER functionality. This may be useful if you end up
rolling your own agent. Sync to the latest source code, because it's not in
the latest Net::LDAP release, which is somewhat out of date.

I'd be very interested in this. Is the SNMP code available somewhere
or is it used in your company? Traps would be possible to add I
suppose (if I study the protocol somewhat...)?

/Marcus
 
M

Marcus Bristav

We're using it internally and it works quite well. Traps are not difficult
to implement, but they do evil things to your network ;-). The agent would
need some documentation before a public release. Are you willing to help
with that?

I can help with documentation. Keep in mind though that I'm still in
research mode so the speed won't be that great initially. But I've
heard only good things about Eventmachine so it will be exciting to
test it out and learn to use it. Maybe we can find more uses for it
here :)

/Marcus
 
M

Marcus Bristav

Ok. You can send me offlist to my address used here.

This sounds very interesting indeed. Thanks a lot :)

/Marcus

I can help with documentation. Keep in mind though that I'm still in
research mode so the speed won't be that great initially. But I've
heard only good things about Eventmachine so it will be exciting to
test it out and learn to use it. Maybe we can find more uses for it
here :)



Ok, I refactored our app-specific MIB handling out and I have a
functionally-complete SNMP agent (minus trap support). You have to add your
own MIBs. Eventually we should have built-in support
for the standard ones, as long as they are easily scriptable. Here's what
your code would look like:

#--------------------------------------------------------
require "rubygems"
require "eventmachine"
require "net/snmp"

require 'snmpagent'
include EventMachine::SnmpAgent

agnt = Agent.new :verbose=>true

agnt.add_object [1,3,6,1,2,1,1,1,0], "baloney"
agnt.add_object [1,3,6,1,2,1,1,3,0], proc {`cat
/proc/uptime`.split.first.to_i * 100}

agnt.run
#--------------------------------------------------------


You can test with snmpwalk or any "real" management system. This code has
been tested against OpenView, Argent, SolarWinds, and some others. Obviously
the example only adds two managed objects. In practice you would add your
"real" objects in a Ruby module whose name you pass to
EventMachine::SnmpAgent::Agent#new.

If you're interested, I can send the library to your private email. If
anyone else is interested, let me know here and I'll put a distro package on
the EventMachine rubyforge page.

The net/snmp library comes from the Net::LDAP library (on Rubyforge).
 
B

Brian Candler

agnt = Agent.new :verbose=>true

agnt.add_object [1,3,6,1,2,1,1,1,0], "baloney"
agnt.add_object [1,3,6,1,2,1,1,3,0], proc {`cat
/proc/uptime`.split.first.to_i * 100}

agnt.run ...
If you're interested, I can send the library to your private email. If
anyone else is interested, let me know here and I'll put a distro package on
the EventMachine rubyforge page.

I'm interested.

Regards,

Brian.
 
P

Peña, Botp

From: Francis Cianfrocca [mailto:[email protected]]=20
# anyone else is interested, let me know here and I'll put a=20
# distro package on the EventMachine rubyforge page.

pls. thanks for eventmachine et al.
kind regards -botp
 
M

Matt Matson

Francis said:
We're using it internally and it works quite well. Traps are not
difficult
to implement, but they do evil things to your network ;-). The agent
would
need some documentation before a public release. Are you willing to help
with that?

Is there anyone else who would want to use such a thing?

I'm very interested in using / contributing to your agent code!
-m2matson
 
F

Francis Cianfrocca

[Note: parts of this message were removed to make it a legal post.]

I'm very interested in using / contributing to your agent code!
-m2matson



Take a look at the implementation in Ruby/EventMachine. The SNMP agent
skeleton is in a separate gem which you'll find on the Rubyforge
EventMachine project page. The test cases should show you how to use it.
It's pretty simple, actually.
 

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

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top