Logo
Home page Net-SNMP

Archive Search:

Require all words?

Site Search:
Google
Checklist for adding a MIB module to the UCD-SNMP agent

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
         
    • Check 1
      Does the file agent/Makefile contain a reference to mymib?

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

    • Check 2
      Is there now a file agent/mibgroup/mymib.o?

  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.).

    • Check 3a
      Does the agent respond to requests?
                $ snmpgetnext -p 9999 localhost public system
      	  system.sysDescr.0 = something or other
           

    • Check 3b
      Does the agent respond to requests for objects in your new module?
                $ snmpgetnext -p 9999 localhost public .1.3.6.1.4.1.9999
      	  .1.3.6.1.4.1.9999.1.1.0 = something or other
           
      (Replace this OID with the OID at the top of the subtree that you're implementing in this module.)

    • Check 3c
      Can the tools parse the MIB file?
                $ snmpgetnext -OS -p 9999 localhost public MY-MIB::myObject
      	  MY-MIB::myObject.0 = something or other
           
      (Replace the module name with the name of the MIB module you are implementing, and the object name with the name of one of the objects in this module.)

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

    • Check 4
      Does the newly installed agent have the correct (i.e. recent) timestamp?
                $ ls -l /usr/local/sbin/snmpd
           
      (This is the most likely location for the new agent. But use whatever was reported as part of the make install output).

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

    • Check 5
      Repeat Checks 3a, 3b and 3c
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). [an error occurred while processing this directive]

Valid CSS!


Last modified: Wednesday, 01-Aug-2018 04:41:28 UTC
For questions regarding web content and site functionality, please write to the net-snmp-users mail list.