Difference between revisions of "FAQ:Coding 18"

From Net-SNMP Wiki
Jump to: navigation, search
 
(Move FAQ text to a template page & 5.4 release synchronisation)
 
Line 1: Line 1:
= How can I get the agent to generate a trap (or inform)? =  
+
= How can I get the agent to send an SNMPv1 enterprise-specific trap? =  
  
{{FAQ:Coding_18}}
+
<!-- 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.
 +
-->
 +
{{FAQ:Coding_21}}
  
 
     [[FAQ:Coding]]
 
     [[FAQ:Coding]]
 
     {{FAQ:Coding}}
 
     {{FAQ:Coding}}

Latest revision as of 14:22, 29 December 2006

How can I get the agent to send an SNMPv1 enterprise-specific trap?

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.

   FAQ:Coding
   
  1. How do I write C code to integrate with the agent?
  2. How does the agent fetch the value of a MIB variable from the system?
  3. Mib2c complains about a missing "mib reference" - what does this mean?
  4. Mib2c complains about not having a "valid OID" - what does this mean?
  5. Why doesn't mib2c like the MIB file I'm giving it?
  6. Mib2c ignores my MIB and generates a pair of 'mib-2' code files. Why?
  7. What's the difference between the various mib2c configuration files?
  8. Which mib2c configuration file should I use?
  9. How can I have mib2c generate code for both scalars and tables?
  10. Are there any examples, or documentation for generating MIB modules?
  11. Where should I put the files produced by 'mib2c'?
  12. Why doesn't my new MIB module report anything?
  13. Why does the iterator call my get_{first,next} routines so often?
  14. How can I get the agent to generate a trap (or inform)?
  15. How can I get an AgentX sub-agent to generate a trap (or inform)?
  16. How can I get the agent to send an SNMPv1 (or SNMPv2c) trap?
  17. How can I get the agent to include varbinds with an SNMPv1 trap?
  18. How can I get the agent to send an SNMPv1 enterprise-specific trap?
  19. How can I get the agent to send an SNMPv3 trap (or inform)?
  20. Why does calling 'send_v2trap' generate an SNMPv1 trap (or vice versa)?
  21. How can I register a MIB module in a different (SNMPv3) context?