Checklist for adding a MIB module to the UCD-SNMP agent

We're often asked how to add a MIB implementation module (e.g. as produced by mib2c) to the agent, and check that it's working. The following is a step-by-step guide to the process, with frequent checks to confirm that things have been successful.

Please note that if, at any point, a particular check fails to return the results expected you should not proceed with the next stage. Instead you should try and identify what went wrong since the previous (successful) check, and fix it.

Note further that the various names (MIB files, modules, objects and numeric OIDs) are examples only. You should replace them with the appropriate names for the MIB module you are implementing. Such names will be given in italics in the examples.

Checklist

  1. Remove any old copies of the source tree that you might have, and unpack a new, clean copy from the tarball.
    (This isn't strictly necessary, but is a useful step to avoid earlier attempts getting in the way)

  2. Copy the two files produced by mib2c into the directory agent/mibgroup in this clean tree:
              $ cd ~/ucd-snmp-4.2.1
                   or wherever the tarball was unpacked to
              $ cd agent/mibgroup
              $ cp ~/mymib.[ch] .
                   or wherever the files were generated
         
  3. Configure the source code to include your new MIB module:
              $ cd ../..
              $ ./configure --with-mib-modules=mymib
         

  4. Compile the suite (make) but don't install it yet.

  5. Run the newly-compiled agent in a 'testing' mode:
              $ agent/snmpd -f -L -d -p 9999
         
    (This runs the agent on a temporary port ( -p 9999) so that it doesn't need special priviledges, or interfere with your 'normal' agent. Incoming and outgoing packets are printed (-d), to show what's happening, and the agent is run as a 'non-daemon' command (-f -L) so that you can see these messages. Note that this ties up the current shell, so you'll need to run the following checks in a different terminal window.).

  6. Kill the 'test' agent. (Ctrl-C should do it).
  7. Install the agent. (make install).

  8. Run the newly-installed agent in a 'testing' mode, as before.
              $ /usr/local/sbin/snmpd -f -L -d -p 9999
         

If all this succeeds, your newly installed agent appears to be working correctly. It's probably safe to consider running this new agent instead of the one that comes with your distribution (if this is what you want to do).