Reputation: 151
I've been looking around and can't seem to find an answer to this question. I'm working with snmpd from net-snmp on an embedded project. I have extra code written into snmpd to support GETs and v2 traps, but now I may need to switch over to v3 traps/informs.
So, here's my question:
Assuming I've set up my v3 passwords, encryption, etc., is there a v3 analog to the send_v2trap()
function? I can't imagine it's as easy as send_v3trap()
but there's got to be a straight forward way.
Also, I'm strictly restricted to C. I imagine this might be easier using net-snmp bindings in other languages, but that's not an option for me.
Upvotes: 0
Views: 1005
Reputation: 2536
From netsnmp_trap_api(3)
:
send_v2trap() uses the supplied list of variable bindings to form an
SNMPv2 trap, which is sent to SNMPv2-capable sinks on the configured
list. An equivalent INFORM is sent to the configuredq list of inform
sinks. Sinks that can only handle SNMPv1 traps are skipped.
This seems to indicate that the same function should be able to send v3 traps as well (since v3 traps are identical to v2 traps).
Furthermore, looking at the code (specifically, agent/agent_trap.c
), one can indeed see that your initial guess is correct and that send_v3trap()
function exists. There is a comment above the definition, saying:
Similar to send_v2trap(), with the added ability to specify a context. If
the last parameter is NULL, then this call is equivalent to send_v2trap().
Hope this helps.
Upvotes: 1