[ First - *please* don't mail me privately, without copying any responses to the mailing list. I don't have the time or inclination to offer private, unpaid, SNMP consultancy. Keep discussions to the list, where others can both learn and offer advice. Thanks. ]
On Thu, 2005-10-27 at 20:11 +0000, xuemei wrote: > Hi, > > < > You need to tell mib2c to load the MIB files that define the > MIB subtree you want to implement. > > If you've got a file MY-MIB, that defines a subtree rooted at > .1.3.6.1.4.1.123456789 and named "myRoot", then try > > mib2c MY-MIB::myRoot > > If the MIB files aren't being loaded, then mib2c can't know what > object to generate code for. > > > > I do not have a MIB environment variable, but I know the default > dir to search a mib file is /usr/share/snmp/mibs, and MY-MIB file is there. OK - but you *do* need to tell mib2c to load it. Either using an environment variable, or a command-line option, or by explicitly specifying the MIB file to load. See the FAQ entry: How do I add a MIB to the tools? > mib2c MY-MIB::myRoot is equivalent to mib2c MY-MIB::1.3.6.1.4.1.123456789 > in my case, Fair enough (though you should really apply for your own enterprise number). But note that the second form probably isn't valid, and will almost certainly confuse mib2c. Most SNMP tools can work quite happily with numeric OIDs, and just use the MIB file to convert the results into a more meaningful output. That's not true of mib2c - it *relies* on the MIB file to decide what code template to generate. > but it indicates: > > You didn't give mib2c a valid OID to start with.IE, I could not find any > information about the mib node, or by the MIV that you're trying to generate > code form isn't loaded........ > > Do I have to setup the MIB variable? No - running mib2c MY-MIB::myRoot should work OK. It sounds as if there's a problem with your MIB file. > < > You can always use the Net-SNMP experimental area. > Try defining a MIB that sits underneath > > NET-SNMP-MIB::netSnmpPlaypen > > That's *exactly* what this subtree is provided for! > (Just please make sure that you don't release any code > that uses this subtree.) > > > > Are you sure, I could not find netSnmpPlaypen inside the > NET-SNMP-MIB.txt file? Yes - I *am* sure: NET-SNMP-MIB DEFINITIONS ::= BEGIN -- -- Top-level infrastructure of the Net-SNMP project enterprise MIB tree -- [snip] -- -- A subtree specifically designed for private testing purposes. -- No "public" management objects should ever be defined within -- this tree. -- -- It is provided for private experimentation, prior to transferring -- a MIB structure to another part of the overall OID tree -- netSnmpPlaypen OBJECT IDENTIFIER ::= {netSnmpExperimental 9999} Dave ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users