SNMP agent library?

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

I know the snmp lib can send traps, I am looking into the MIB part right now
so I am interested in any information in that area too.

···

On 4/12/07 5:37 PM, "Marcus Bristav" <marcus.bristav@gmail.com> wrote:

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

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.

···

On 4/12/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:

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.

Hi Francis,

···

On 4/13/07, Francis Cianfrocca <garbagecat10@gmail.com> wrote:

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

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?

···

On 4/13/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:

Hi Francis,

On 4/13/07, Francis Cianfrocca <garbagecat10@gmail.com> wrote:
> 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

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 :slight_smile:

/Marcus

···

On 4/13/07, Francis Cianfrocca <garbagecat10@gmail.com> wrote:

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?

Francis Cianfrocca wrote:

···

On 4/13/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:

> I put some of the necessary SNMP protocol support in the Net::LDAP
/Marcus

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
--
Posted via http://www.ruby-forum.com/\.

I looked over the code and our MIBs are somewhat interspersed with the
general protocol handling. If it turns out to be easy to refactor, I'll let
you know here.

···

On 4/13/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:

On 4/13/07, Francis Cianfrocca <garbagecat10@gmail.com> wrote:

> 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 :slight_smile:

/Marcus

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:

···

On 4/13/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:

On 4/13/07, Francis Cianfrocca <garbagecat10@gmail.com> wrote:

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 :slight_smile:

#--------------------------------------------------------
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).

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.

···

On Feb 10, 2008 1:54 PM, Matt Matson <m2matson@gmail.com> wrote:

Francis Cianfrocca wrote:
> On 4/13/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:
>> > I put some of the necessary SNMP protocol support in the Net::LDAP
>> /Marcus
>>
>>
>
> 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

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

This sounds very interesting indeed. Thanks a lot :slight_smile:

/Marcus

···

On 4/14/07, Francis Cianfrocca <garbagecat10@gmail.com> wrote:

On 4/13/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:
>
> On 4/13/07, Francis Cianfrocca <garbagecat10@gmail.com> wrote:
>
> 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 :slight_smile:

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).

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.

···

On Sat, Apr 14, 2007 at 11:08:33PM +0900, Francis Cianfrocca wrote:

# anyone else is interested, let me know here and I'll put a
# distro package on the EventMachine rubyforge page.

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

···

From: Francis Cianfrocca [mailto:garbagecat10@gmail.com]

Sent a gem to your private mail. My company wanted me to put GPL language in
it. If this library turns out to be of wider interest, we'll change the
license to Ruby-style.

···

On 4/14/07, Marcus Bristav <marcus.bristav@gmail.com> wrote:

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

This sounds very interesting indeed. Thanks a lot :slight_smile:

I sent you the SNMP agent GEM and a current Windows binary of EventMachine
to your private email. Let me know how it works for you.

···

On 4/15/07, Peña, Botp <botp@delmonte-phil.com> wrote:

From: Francis Cianfrocca [mailto:garbagecat10@gmail.com]
# anyone else is interested, let me know here and I'll put a
# distro package on the EventMachine rubyforge page.

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