Template:FAQ:Coding 21
From Net-SNMP Wiki
There are two ways to do this. You can either use the
'send_v2trap'
call and give a varbind list, starting with
the v2-equivalent of the SNMPv1 trap, followed by the
additional varbinds.
Alternatively, you can use the (undocumented) API call
'send_enterprise_trap_vars'
which takes the same parameters
as 'send_trap_vars'
, plus the enterprise OID to use (in the
usual name/length form). See the code file 'agent_trap.c'
In either case, you also need to have 'trapsink'
in the
snmpd.conf file. The resulting trap will be identical,
whichever approach is used.