snimpy icon indicating copy to clipboard operation
snimpy copied to clipboard

Trap receiver support

Open iwanb opened this issue 8 years ago • 5 comments

I would like to receive SNMP traps and parse them with Snimpy's MIB manager.

Do you have an idea how it could be added? I would guess something like a trap_receiver(port) on the manager, which would listen on the port and give you a manager-like way to navigate the traps, to see if they are active, to suppress them, to count how many were received. Some filtering would also be useful to support larger amounts of traps.

I can have a try at it if you would be interested in such a feature.

iwanb avatar Sep 11 '17 12:09 iwanb

I don't have an opinion on this. This doesn't seem an easy fit for Snimpy API style, but if you manage to find a way to integrate into the existing style, why not.

vincentbernat avatar Sep 11 '17 15:09 vincentbernat

I looked a bit into it and I think the way it would fit is:

  • adding agent or at least in memory table support (like #6 but without serving),
  • each trap/notification would create an in memory "agent" from the variable bindings,
  • you can browse the trap content as if you were querying the agent, e.g. agent.snmpTrapOID.

With this the notification receiver could be completely separate and would not pollute the API.

iwanb avatar Sep 15 '17 14:09 iwanb

I like this plan. 👍

But I cannot help right now.

vincentbernat avatar Sep 15 '17 14:09 vincentbernat

In case somebody would be interested, I found an easier alternative: I use the Net-Snmp smpd server with the snmptrapd receiver as a subagent, and connect to the SNMP server with snimpy. The notifications can be accessed in the NOTIFICATION-LOG-MIB

I had to use this trick to make it work (or I guess you could configure SNMPv3): http://freesnmp.com/net-snmp/faqs/#trapdlog

iwanb avatar Sep 18 '17 12:09 iwanb

Didn't know about that. Nice workaround.

vincentbernat avatar Sep 18 '17 14:09 vincentbernat