Difference between revisions of "Template:FAQ:Coding 21"
From Net-SNMP Wiki
(5.4 release synchronisation) |
|||
Line 1: | Line 1: | ||
+ | <!-- NB: | ||
+ | There is a mismatch between the template numbering | ||
+ | for this entry, and the FAQ entries that refer to it. | ||
+ | This follows a review of the entries in the | ||
+ | Coding section. | ||
+ | --> | ||
There are two ways to do this. You can either use the | There are two ways to do this. You can either use the | ||
− | <CODE>'send_v2trap'</CODE> call and give a varbind list, starting with | + | <CODE>'send_v2trap()'</CODE> call and give a varbind list, |
+ | starting with | ||
the v2-equivalent of the SNMPv1 trap, followed by the | the v2-equivalent of the SNMPv1 trap, followed by the | ||
additional varbinds. | additional varbinds. | ||
Alternatively, you can use the (undocumented) API call | Alternatively, you can use the (undocumented) API call | ||
− | <CODE>'send_enterprise_trap_vars'</CODE> which takes the same parameters | + | <CODE>'send_enterprise_trap_vars()'</CODE> which takes the same parameters |
− | as <CODE>'send_trap_vars'</CODE>, plus the enterprise OID to use (in the | + | as <CODE>'send_trap_vars()'</CODE>, plus the enterprise OID to use (in the |
usual name/length form). See the code file <CODE>'agent_trap.c'</CODE> | usual name/length form). See the code file <CODE>'agent_trap.c'</CODE> | ||
Latest revision as of 14:22, 29 December 2006
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.