Dear all, I've solved this problem. Mabye mib2c can't find the right place where mibs are. Before useing mib2c, you should set the MIBDIRS env var. export MIBS=all export MIBDIRS=/usr/local/share/snmp/mibs
then use mib2c ,it works! Best regars, Sam On 11/17/06, sam luo <[EMAIL PROTECTED]> wrote: > Dear Daniel, > Thanks for your suggestion, but the mib2c still not works well, > I tried the command env MIBS="+OSEE-TEST-MIB" mib2c ustScalarSet. > > # env MIBS="+OSEE-TEST-MIB" mib2c ustScalarSet > (result is:) > Cannot find module (IP-MIB): At line 0 in (none) > Cannot find module (IF-MIB): At line 0 in (none) > Cannot find module (TCP-MIB): At line 0 in (none) > Cannot find module (UDP-MIB): At line 0 in (none) > Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none) > Cannot find module (SNMPv2-MIB): At line 0 in (none) > Cannot find module (SNMPv2-SMI): At line 0 in (none) > Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none) > Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none) > Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none) > Cannot find module (UCD-SNMP-MIB): At line 0 in (none) > Cannot find module (UCD-DEMO-MIB): At line 0 in (none) > Cannot find module (SNMP-TARGET-MIB): At line 0 in (none) > Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none) > Cannot find module (HOST-RESOURCES-TYPES): At line 0 in (none) > Cannot find module (LM-SENSORS-MIB): At line 0 in (none) > Cannot find module (UCD-DISKIO-MIB): At line 0 in (none) > Cannot find module (IPV6-ICMP-MIB): At line 0 in (none) > Cannot find module (IPV6-MIB): At line 0 in (none) > Cannot find module (IPV6-TCP-MIB): At line 0 in (none) > Cannot find module (IPV6-UDP-MIB): At line 0 in (none) > Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none) > Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none) > Cannot find module (IP-FORWARD-MIB): At line 0 in (none) > Cannot find module (NET-SNMP-EXTEND-MIB): At line 0 in (none) > Cannot find module (UCD-DLMOD-MIB): At line 0 in (none) > Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none) > Cannot find module (SNMP-MPD-MIB): At line 0 in (none) > Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none) > Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none) > Cannot find module (SNMPv2-TM): At line 0 in (none) > Cannot find module (OSEE-TEST-MIB): At line 0 in (none) > > You didn't give mib2c a valid OID to start with. IE, I could not find > any information about the mib node "ustScalarSet". This could be caused > because you supplied an incorrectly node, or by the MIB that you're > trying to generate code from isn't loaded. To make sure your mib is > loaded, run mib2c using this as an example: > > env MIBS="+MY-PERSONAL-MIB" mib2c ustScalarSet > > You might wish to start by reading the MIB loading tutorial at: > > http://www.net-snmp.org/tutorial-5/commands/mib-options.html > > And making sure you can get snmptranslate to display information about > your MIB node. Once snmptranslate works, then come back and try mib2c > again. > > > > On 11/17/06, Daniel Lacey <[EMAIL PROTECTED]> wrote: > > > Sam, > > > > > > Try this... > > > > > > env MIBS="+OSEE-TEST-MIB" mib2c ustScalarSet > > > > > > These types of questions are better answered on the users mailing list. > > > > > > General information about the mailing list is at: > > > > > > https://lists.sourceforge.net/lists/listinfo/net-snmp-users > > > > > > > > > > > > sam luo wrote: > > > > Dear all, > > > > > > > > I got some problems using mib2c. It seems the mib2c not work well > > > > on my FC5. > > > > > > > > I use net-snmp-5.3.1.tar.gz on FedoraCore5. My operation step by step > > > > is: > > > > (as root) > > > > 1. copy the net-snmp-5.3.1.tar.gz to /usr/local/src > > > > 2. tar zxvf net-snmp-5.3.1.tar.gz > > > > 3. cd net-snmp-5.3.1 > > > > 4. ./configure (result is ok) > > > > 5. make (result is ok) > > > > 6. make install (result is ok) > > > > 7. cd perl > > > > 8. perl Makefile.PL (result is ok) > > > > 9. make (result is ok) > > > > 10. make install (result is ok) > > > > > > > > It seems the installation of net-snmp-5.3.1 is ok, then I add my own > > > > mib file. > > > > Here is the content of my mib file (OSEE-TEST-MIB.txt) > > > > --my mib file start > > > > OSEE-TEST-MIB DEFINITIONS ::= BEGIN > > > > > > > > IMPORTS > > > > DisplayString > > > > FROM SNMPv2-TC > > > > MODULE-IDENTITY, OBJECT-TYPE, enterprises > > > > FROM SNMPv2-SMI; > > > > > > > > -- > > > > osee OBJECT IDENTIFIER ::= { enterprises 27290 } > > > > ustScalarSet OBJECT IDENTIFIER ::= { osee 1 } > > > > ustSSSimpleString OBJECT-TYPE > > > > SYNTAX OCTET STRING > > > > MAX-ACCESS read-write > > > > STATUS current > > > > DESCRIPTION > > > > "This is a simple test string." > > > > ::= { ustScalarSet 1 } > > > > > > > > ustSSSecondsSinceChanged OBJECT-TYPE > > > > SYNTAX OCTET STRING > > > > MAX-ACCESS read-only > > > > STATUS current > > > > DESCRIPTION > > > > "no use." > > > > ::= { ustScalarSet 2 } > > > > > > > > END > > > > --my mib file end > > > > I copy this file to /usr/local/share/snmp/mibs.Then I do the following > > > > opration: > > > > > > > > cd /usr/local/share/snmp/mibs > > > > export MIBS=all > > > > > > > > # snmptranslate -Tp -IR osee > > > > (the result is:) > > > > +--osee(27290) > > > > | > > > > +--ustScalarSet(1) > > > > | > > > > +-- -RW- String ustSSSimpleString(1) > > > > +-- -R-- String ustSSSecondsSinceChanged(2) > > > > > > > > # snmptranslate -IR ustScalarSet > > > > (the result is:) > > > > OSEE-TEST-MIB::ustScalarSet > > > > > > > > # snmptranslate -IR ustScalarSet -On > > > > .1.3.6.1.4.1.27290.1 > > > > > > > > It seems snmptranslate work well, so I try to run mib2c to generate .c > > > > and .h files. > > > > > > > > #mib2c ustScalarSet > > > > (the result is:) > > > > You didn't give mib2c a valid OID to start with. IE, I could not find > > > > any information about the mib node "ustScalarSet". This could be caused > > > > because you supplied an incorrectly node, or by the MIB that you're > > > > trying to generate code from isn't loaded. To make sure your mib is > > > > loaded, run mib2c using this as an example: > > > > > > > > env MIBS="+MY-PERSONAL-MIB" mib2c ustScalarSet > > > > > > > > You might wish to start by reading the MIB loading tutorial at: > > > > > > > > http://www.net-snmp.org/tutorial-5/commands/mib-options.html > > > > > > > > And making sure you can get snmptranslate to display information about > > > > your MIB node. Once snmptranslate works, then come back and try mib2c > > > > again. > > > > > > > > > > > > Did I do something wrong? > > > > Is there any problem with my mib file? > > > > Do I need to use the mib2c configuration file such as > > > > mib2c.scalar.conf? > > > > > > > > > > > > > > > > any suggestion will be appreciated. > > > > > > > > Best regards, > > > > Sam > > > > > > > > ------------------------------------------------------------------------- > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > > > your > > > > opinions on IT & business topics through brief surveys - and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > _______________________________________________ > > > > Net-snmp-coders mailing list > > > > Net-snmp-coders@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/net-snmp-coders > > > > > > > > > > > > > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders