FAQ:Coding 13

From Net-SNMP Wiki

Jump to: navigation, search

I've added my code to this template and it still doesn't work. Why not?

It's difficult to provide a definitive answer to that. The best we can do is suggest a checklist that might help pinpoint the source of the problem. Try looking at the following:

  • Is the new module being compiled?
    (Delete any .o files, and re-run 'make'. Are the .o files re-created?)
  • Is it being included in the agent library?
    (Run 'nm' on the library and look for the names of the initialisation routine and variable handlers)
  • Is the initialisation routine being run?
    (Activate the debugging code that you put into this routine. You do include debugging code as a matter of course, don't you?)
  • Has the module been registered with the agent?
    (Try walking the NET-SNMP-MIB::nsModuleTable. This will also check whether the agent accepts requests for enterprise-specific OIDs)
  • Is the module handler actually being called at all?
    (Activate the debugging code that you put into this handler, and do a single 'snmpget' or 'snmpgetnext' for a suitable instance. You do include debugging code as a matter of course, don't you?)
  • Is it returning success or an error?
    (Activate the debugging code.... but you get the idea!)

That won't actually solve the problem, but at least you'll have some idea where to look.

   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?
  11. Where should I put the files produced by 'mib2c'?
  12. I've created a new module with 'mib2c' but it doesn't work. Why not?
  13. I've added my code to this template and it still doesn't work. Why not?
  14. Why does the iterator call my get_{first,next} routines so often?
  15. How can I get the 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. What if I'm using an AgentX sub-agent instead?
  22. How can I register a MIB module in a different (SNMPv3) context?
Personal tools