Announcement

Collapse
No announcement yet.

Loading MIB files in net-snmp

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loading MIB files in net-snmp

    Hi,

    I'm doing a project to implement net-snmp trap for Xport Pro. Right now I can compile the net-snmp package and make the uclinux image by starting from the very beginning (deleting the whole net-snmp/build folder). I can also add my own applications using the package's base APIs (add them into net-snmp/apps folder). However, It seems that the MIB files can not be installed and loaded whether I select it or not (from make menuconfig). The attached is the log file for the compilation. In it you will see the following "command not found" messages right after the Net-SNMP configuration summary:

    Code:
    ---------------------------------------------------------
    Net-SNMP configuration summary:
    ---------------------------------------------------------
    
    SNMP Versions Supported: 1 2c 3
    Building for: linux
    Net-SNMP Version: 5.5
    Network transport support: Callback Unix Alias TCP UDP
    SNMPv3 Security Modules: usm
    Agent MIB code: default_modules => snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars mibII/vacm_conf utilities/execute
    MYSQL Trap Logging: unavailable
    Embedded Perl support: disabled
    SNMP Perl modules: disabled
    SNMP Python modules: disabled
    Authentication support: MD5
    Encryption support:
    
    ---------------------------------------------------------
    
    make -j1 xEXT=a xDIR= -C build
    make[5]: Entering directory `/home/lantronix/linuxsdk/linux/user/net-snmp/build'
    WARNING: not running autoconf
    WARNING: not running autoheader
    ucfront-gcc m68k-uclinux-gcc -mcpu=5208 -DCONFIG_COLDFIRE -fomit-frame-pointer -pipe -fno-common -fno-builtin -fno-dwarf2-cfi-asm -msep-data -D__linux__ -Dunix -D__uClinux__ -DEMBED -Os -g -D__deprecated= -Dfork=vfork -E -Iinclude -I../include -I../agent/mibgroup -I. -I.. -DDONT_INC_STRUCTS -DBINDIR=/bin -x c ../sedscript.in | egrep '^s[/#]' | sed 's/REMOVEME//g;s# */#/#g;s/ *#/#/g;s#/ *#/#g;s/# g/#g/;' > sedscript
    echo 's/VERSIONINFO/5.5/g' >> sedscript
    echo 's#DATADIR#/share#g' >> sedscript
    echo 's#LIBDIR#/lib#g' >> sedscript
    echo 's#BINDIR#/bin#g' >> sedscript
    echo 's#PERSISTENT_DIRECTORY#/var/net-snmp#g' >> sedscript
    echo 's#SYSCONFDIR#/etc#g' >> sedscript
    /bin/sed -f sedscript ../EXAMPLE.conf.def > EXAMPLE.conf
    making all in /home/lantronix/linuxsdk/linux/user/net-snmp/build/snmplib
    make[6]: Entering directory `/home/lantronix/linuxsdk/linux/user/net-snmp/build/snmplib'
    /bin/sh ../libtool --mode=compile ucfront-gcc m68k-uclinux-gcc -mcpu=5208 -DCONFIG_COLDFIRE -fomit-frame-pointer -pipe -fno-common -fno-builtin -fno-dwarf2-cfi-asm -msep-data -D__linux__ -Dunix -D__uClinux__ -DEMBED -Os -g -D__deprecated= -Dfork=vfork -I../include -I../../include -I. -I../snmplib -I../../snmplib -D__deprecated= -Dfork=vfork -Ulinux -Dlinux=linux -c -o snmp_client.lo ../../snmplib/snmp_client.c
    ../libtool: line 46: -mcpu=5208: command not found
    libtool: compile: ucfront-gcc m68k-uclinux-gcc -mcpu=5208 -DCONFIG_COLDFIRE -fomit-frame-pointer -pipe -fno-common -fno-builtin -fno-dwarf2-cfi-asm -msep-data -D__linux__ -Dunix -D__uClinux__ -DEMBED -Os -g -D__deprecated= -Dfork=vfork -I../include -I../../include -I. -I../snmplib -I../../snmplib -D__deprecated= -Dfork=vfork -Ulinux -Dlinux=linux -c ../../snmplib/snmp_client.c -o snmp_client.o
    /bin/sh ../libtool --mode=compile ucfront-gcc m68k-uclinux-gcc -mcpu=5208 -DCONFIG_COLDFIRE -fomit-frame-pointer -pipe -fno-common -fno-builtin -fno-dwarf2-cfi-asm -msep-data -D__linux__ -Dunix -D__uClinux__ -DEMBED -Os -g -D__deprecated= -Dfork=vfork -I../include -I../../include -I. -I../snmplib -I../../snmplib -D__deprecated= -Dfork=vfork -Ulinux -Dlinux=linux -c -o mib.lo ../../snmplib/mib.c
    ../libtool: line 46: -mcpu=5208: command not found
    
    .........................
    There is also a line above the net-snmp summary which may be worthy noticing:

    configure: WARNING: Can't check sysctl, manually define NETSNMP_CAN_USE_SYSCTL if platform support available.

    Please help! Thanks.

    Peter

  • #2
    Also, has anybody ever made snmpd running on xport pro? I can see it's in there, and I can get some net-snmp applications running (eg. snmptrap, snmpget...), but I can't run snmpd no matter how I modify the snmpd.conf file. Here is a error message I usually get:

    Code:
    snmpd -c mnt/flash/share/snmp/snmpd.conf -Le -Dread_config
    registered debug token read_config, 1
    Cannot find module (SNMPv2-MIB): At line 0 in (none)
    Cannot find module (SNMPv2-SMI): 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 (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-FRAMEWORK-MIB): At line 0 in (none)
    Peter
    Last edited by wzhdz; 02-04-2011, 03:09 PM.

    Comment


    • #3
      Hi,

      I have succesfully run snmpd in Xport Pro.
      You must not load MIB files directly. Try mib2c tool.
      Start by setting up net-snmp to your linux PC. (enable tkmib tool also helps)
      Then make your c code with mib2c tool (you can find tutorials at www.net-snmp.org).
      After that copy your files (example nstAgentModuleObject.c and nstAgentModuleObject.h) to agent/mibgroup folder in Lantronix SDK.

      Your module is named now "nstAgentModuleObject".

      I had problems building net-snmp, and I manually changed makefile
      1. uncomment line CONFIG_USER_NETSNMP_BUILDSTATIC=1
      2. add module name "nstAgentModuleObject" from make menuconfig
      3. add this line to makefile manually
      NET_SNMP_CFG += --with-mib-modules="nstAgentModuleObject"
      bellow line : NET_SNMP_CFG += --enable-mini-agent

      Comment


      • #4
        Hi Alex,

        Thank you very much for your reply. I'll definitely try your method. I have 2 more questions to ask.

        1). After all this is done, I assume that you still start the agent by running snmpd (now with the added functionality from your module). If this is the case, can you query the agent with other information like system location, contact etc (remember other mib modules are not loaded)?

        2). How do you load the snmpd.conf file? Can you build it into the image?


        Thanks,

        Peter


        BTW, what I did was putting my own files in the net-snmp/apps folder, making changes similar to adding new applications outlined in Linux-SDK_UG. In this way, I can produce "home-made" net-snmp applications (I'm using one to send out traps).

        Comment


        • #5
          Hi Peter,

          1) The method I described adds extra functionality to the default snmpd agent.
          The agent still replies to location, contact, systemUpTime,... plus the oids I write my own.

          2) To save snmpd.conf inside image, copy your file to LantronixSDK/linux/vendors/Lantronix/Xport_Pro/romfs_extra/etc
          A link is created to /etc/snmpd.conf (inside image)

          You can also add this line to 'start' file (at the end) :
          /bin/snmpd -c "/etc/snmpd.conf"
          ('start' file located in /linux/vendors/Lantronix/Xport_Pro/romfs_extra/etc)
          snmpd starts automatically with system start

          Comment


          • #6
            Many thanks Alex!

            I also got everything worked out here. It looks like the sdk only load the default mib modules (snmpv3 mibs, mibII etc as suggested in the configuration summary) no matter you select it or not from "make menuconfig". The "load additional mib" doesn't work either. Other than that, it seems that net-snmp can fully function on Xport Pro.

            When you look at the code in the makefile:
            Code:
            ifdef CONFIG_USER_NETSNMP_MIBS
            ifndef CONFIG_USER_NETSNMP_MIBLOADING
            NET_SNMP_CFG += --disable-mib-loading
            endif
            else
            NET_SNMP_CFG += --disable-mibs --disable-mib-loading
            endif
            it seems to me like If you define CONFIG_USER_NETSNMP_MIBS then do nothing, but if you don't, disable everything.... This may explain a bit.

            Peter

            Comment


            • #7
              I just find out the "Additional MIBs" in "make menuconfig" is working if you delete the "build" folder and do a fresh compilation. You can also add more than 1 module by adding a space between module names.

              However, it stops working if you want to add additional modules later on, no corresponding .o and .lo files will be created in the build/agent/mibgroup folder as they are supposed to. I also find the similar behavior when building net-snmp applications.

              Peter

              Comment


              • #8
                How to use net-snmp commands?

                Hi there,

                I have been reading this thread and you say that you are able to use snmpget, snmpset and other net-snmp commands. I have only installed the net-snmp and its applications but no MIB module.

                I wonder if you could explain me how to do it, i tried to use snmpget as follows:

                snmpget -v 1 -c private 192.168.1.56 .1.3.6.1.4.1.######.2.1.7.1

                The output is:

                No log handling enabled - using stderr logging
                snmpget: (null)


                Note: #### stands for unique IANA Id for my Enterprise.

                Comment

                Working...
                X