Search code examples
installationsnmpnet-snmp

snmpd doesn't respond when I compile from source


OS that I am using: Fedora 15.

Today morning, I removed net-snmp rpm package previously installed on my system. Then, I compiled and installed snmp from source. Compiled snmpd does not respond to any get requests.

I installed the package by executing these commands:

./.configure && make && make install

After a while it was done and I find the installation was successful.

For testing the installation I ran a get request:

snmpget -v2c -c public 127.0.0.1 sysDescr.0

Weird I feel, no response... What could I be missing? a super-user privilege is required?


Solution

  • Additionally, there are few steps that need to be performed for installation from source.

    Follow here,

    Step 1: Log in as root (su - root)

    Step 2: Navigate to the home folder where the net-snmp tar.gz is kept Issue this command at the prompt

    tar -zxvf net-snmp-5.5.tar.gz
    

    (I still happen to use v 5.5. Change this with your version)

    Step 3: Navigate to the un-tarred directory.

    Step 4: Run ./configure

    Step 5: make

    Step 6: make install

    Step 7: You now have netsnmp installed and ready to use.

    Ha Ha .. not quite.. there are still lot of stuff that needs to be done before we can say...yep..thats working beautifully..

    Step 8: Navigate to /usr/local/bin to see if the folder has a bunch of snmp stuff like snmpconf snmptranslate and so on...

    Step 9: Also see if the /usr/local/share/snmp/mibs folder and see if all the MIB files are present..

    Step 10: If everything is fine until here try to do some configurations checking (else start-over). Run,

    net-snmp-config --default-mibdirs
    

    and you must get the output

    /root/.snmp/mibs:/usr/local/share/snmp/mibs
    

    Run,

    net-snmp-config --snmpconfpath
    

    output should be like

    /usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/root/.snmp:/var/net-snmp
    

    Step 11: Run,

    ldd /usr/local/bin/snmptranslate
    

    output will be:

    linux-gate.so.1 =>  (0x00110000)
           libnetsnmpagent.so.15 => not found
           libnetsnmphelpers.so.15 => not found
           libnetsnmpmibs.so.15 => not found
           libnetsnmp.so.15 => not found
    

    This means that you might get snmp*: error while loading shared libraries: like for example as mentioned above libnetsnmp.so.20: It cannot open shared object file.

    If no error comes like above , no need to do anything, but if error comes, then, you have to do the steps below Edit ld.so.conf in /etc and add the details of the lib path of /usr/local/lib and then run ldconfig

    vi /etc/ld.so.conf
    
    /usr/X11R6/lib/Xaw3d
    /usr/X11R6/lib
    /usr/lib/Xaw3d
    /usr/i386-suse-linux/lib
    /usr/local/lib
    /opt/kde3/lib
    include /etc/ld.so.conf.d/*.conf
    

    (I happen to Use Suse a lot. But something is also very similar to Debian)

    Step 12: Run,

    ldconfig
    

    Step 13: Now you have to tell netsnmp where to look for MIB files. You use the snmpconf command to do this. Issue this command at the prompt.

    snmpconf
    

    This is what it will appear on your screen,

    I can create the following types of configuration files for you. Select the file type you wish to create: (you can create more than one as you run this program) 1: snmpd.conf 2: snmptrapd.conf 3: snmp.conf Other options: quit

    Select File: 3

    The configuration information which can be put into snmp.conf is divided into sections. Select a configuration section for snmp.conf that you wish to create: 1: Debugging output options 2: Textual mib parsing 3: Output style options 4: Default Authentication Options Other options: finished

    Select section: finished

    I can create the following types of configuration files for you. Select the file type you wish to create: (you can create more than one as you run this program) 1: snmpd.conf 2: snmptrapd.conf 3: snmp.conf Other options: quit

    Select File: quit

    The following files were created: snmp.conf

    These files should be moved to /usr/local/share/snmp if you want them used by everyone on the system. In the future, if you add the -i option to the command line I'll copy them there automatically for you.

    Or, if you want them for your personal use only, copy them to /root/.snmp . In the future, if you add the -p option to the command line I'll copy them there automatically for you.

    Step 14: Copy the snmp.conf file.

    cp snmp.conf /usr/local/share/snmp/
    

    Step 15: Finally try this.

    snmptranslate -Tp -IR ipMIB
    

    You will observe a tree structure on your screen. This means that everything that you have installed is working

    So now the errors are not going to be there because of configuration.. whatever gets screwed up , its your responsibilty ;-)

    Cheers,