Difference between revisions of "Template:FAQ:Coding 20"

From Net-SNMP Wiki
Jump to: navigation, search
 
(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 API call <CODE>'send_trap_vars'</CODE>
+
Alternatively, you can use the API call <CODE>'send_trap_vars()'</CODE>
 
which takes the same generic/specific trap values as
 
which takes the same generic/specific trap values as
<CODE>'send_easy_trap'</CODE>, plus the list of additional varbinds.
+
<CODE>'send_easy_trap()'</CODE>, plus the list of additional varbinds.
  
 
In either case, you also need to have <CODE>'trapsink'</CODE> in the
 
In either case, you also need to have <CODE>'trapsink'</CODE> in the
 
<CODE>snmpd.conf</CODE> file.  The resulting trap will be identical,
 
<CODE>snmpd.conf</CODE> file.  The resulting trap will be identical,
 
whichever approach is used.
 
whichever approach is used.

Latest revision as of 14:18, 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 API call 'send_trap_vars()' which takes the same generic/specific trap values as 'send_easy_trap()', plus the list of additional varbinds.

In either case, you also need to have 'trapsink' in the snmpd.conf file. The resulting trap will be identical, whichever approach is used.