FreeBSD 6.2 + my gensnmptree issue

Hartmut Brandt hartmut.brandt at
Wed Oct 17 08:49:44 PDT 2007

On Wed, 17 Oct 2007, Jeff Royle wrote:

JR>I am having an issue which is most likely my lack of understanding and not a
JR>problem with 6.2 itself.
JR>The system is running 6.2-RELEASE and I use bsnmpd.  Here is the uname
JR>FreeBSD lucky.orisit 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Wed Oct 10 10:40:51
JR>EDT 2007
JR>What I am trying to do is get bsnmp to respond to new MIBs, specifically
JR>After reading the manpages for bsnmp and gensnmptree I believe gensnmptree is
JR>the command I need to use.
JR>This is where I get into trouble.   The gensnmptree command doesn't give me
JR>any results no matter what I do.  Even using a bug report example of
JR>gensnmptree -e sysName gives me no results.
JR>So I proceeded to do some more google searching and noticed gensnmpdef was
JR>referenced several times as the program which may be what I need to use.
JR>I found the code for this in /usr/src/contrib/bsnmp/gensnmpdef without a
JR>makefile.   There is no gensnmpdef in /usr/sbin on the system but it is in
JR>the /usr/ports/net-mgt/bsnmpd/pkg-plist.
JR>So I guess I need some guidance.   Can I use gensnmptree to get this MIB into
JR>the bsnmp system? If so how is this done? -or- Is there a problem with the
JR>6.2 release for gensnmpdef and that is in fact the program I am suppose to be
JR>Any assistance would be appreciated.

Well, yes that would be the tool, but things are more complicated. BSNMP 
uses a special file format (the .def files) to automatically create some 
tables and #defines when you implement a MIB. If you invent your own MIB, 
you normally write the .def file from scratch. It basically contains the 
same info as the MIB file, but in a less baroque and more machine-parsable 
format. If you're going to implement a MIB for which you already have a 
MIB file you can shorten the time to write the .def file by feeding the 
MIB file into gensnmpdef. It will create you an initial .def file, which, 
in most cases, you have to edit, though.

But having the .def file is only the start of implementing. Because then 
you must write the action routines that actually implement the MIB 
behaviour. You might look under /usr/src/contrib/bsnmp/snmp_mibII. Here 
you find an example .def file the contents of which you might find 
familiar. The .c files there implement the semantic of the standard MIB-2.

gensnmpdef is not built automatically, because it requires libsmi which 
you need to install from ports.


More information about the freebsd-questions mailing list