Giter VIP home page Giter VIP logo

Comments (16)

 avatar commented on May 22, 2024 2

I'm using Ubuntu 12 and can reproduce this problem. I installed net-snmp 5.7.3 from source. I believe the problem is related to not being able to locate the libnetsnmp.so given that is where the symbol is located.

You can run this command: LD_PRELOAD=/usr/local/lib/libnetsnmp.so python
and see there is no problem. I suppose the configuration for where python should load libraries varies across systems which is why this problem occurs.

I hope this helps future users of this great python library.

from easysnmp.

fgimian avatar fgimian commented on May 22, 2024

Yep, the reason this is likely happening is that you're not running net-snmp 5.7.x. Please upgrade your Net-SNMP libraries to 5.7.2 or 5.7.3 and everything should work correctly.

Cheers
Fotis

from easysnmp.

nnathan avatar nnathan commented on May 22, 2024

What version of net-snmp are you currently running? I'm tempted to see if I can get it supported in the C backend.

from easysnmp.

fgimian avatar fgimian commented on May 22, 2024

@nnathan worth a shot, but don't forgot, we have OSs shipping with versions as old as 5.4. It may be quite a challenge to support them all (but worthwhile if not too much work). 😄

from easysnmp.

mlammon avatar mlammon commented on May 22, 2024

net-snmp-devel-5.5-50.el6_6.1.x86_64 is the package currently on the system

yum install net-snmp-devel
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Install Process
Package 1:net-snmp-devel-5.5-50.el6_6.1.x86_64 already installed and latest version

from easysnmp.

mlammon avatar mlammon commented on May 22, 2024

I installed 5.7.3. I believe its installed correctly but I am still facing the same error trying to use this easysnmp module

which snmpget

/usr/local/bin/snmpget

/usr/local/bin/snmpget --version

NET-SNMP version: 5.7.3

from easysnmp.

fgimian avatar fgimian commented on May 22, 2024

You'll need to ensure that you re-install the package via pip after installing the latest version of Net-SNMP. Further to this, you'll need to ensure that easysnmp is using the correct header files and libraries for the new version of Net-SNMP which you have installed.

The following code in setup.py configures your libdirs. You may wish to use the print statement after this code to confirm that the correct paths are being detected:

# If a base directory has been provided, we use it
if in_tree:
    netsnmp_libs = os.popen(basedir + '/net-snmp-config --libs').read()

    libdir = os.popen(
        basedir + '/net-snmp-config --build-lib-dirs ' + basedir).read()
    incdir = os.popen(
        basedir + '/net-snmp-config --build-includes ' + basedir).read()

    libs = re.findall(r' -l(\S+)', netsnmp_libs)
    libdirs = re.findall(r' -L(\S+)', libdir)
    incdirs = re.findall(r' -I(\S+)', incdir)

# Otherwise, we use the system-installed SNMP libraries
else:
    netsnmp_libs = os.popen('net-snmp-config --libs').read()

    libs = re.findall(r' -l(\S+)', netsnmp_libs)
    libdirs = re.findall(r' -L(\S+)', netsnmp_libs)
    incdirs = []

Good luck
Fotis

from easysnmp.

nnathan avatar nnathan commented on May 22, 2024

I think this will only handle the case of compiling and installing the module. When Python runs, it will also need to load /usr/local/lib/libsnmp.so BEFORE /usr/lib/libsnmp.so (if I understand correctly, you have two versions installed). In that case you will need to configure the runtime linker to load from /usr/local/lib first, so I think that would involve something like LD_PRELOAD=/usr/local/lib/libsnmp.so python (or something in that vein) so that Python uses the newer version of the library.

from easysnmp.

fgimian avatar fgimian commented on May 22, 2024

@mlammon any update on this? I'll be closing the issue in a few days as I'm assuming you've got it all working 😄

from easysnmp.

mlammon avatar mlammon commented on May 22, 2024

Thanks Fotis. You can close it by I never did resolve it. It's ok though

On Jun 28, 2015, at 3:11 AM, Fotis Gimian [email protected] wrote:

@mlammon any update on this? I'll be closing the issue in a few days as I'm assuming you've got it all working


Reply to this email directly or view it on GitHub.

from easysnmp.

fgimian avatar fgimian commented on May 22, 2024

@mlammon OK, I do suspect this is an issue with your install of Net-SNMP as we have gotten it working perfectly. Perhaps try again on a fresh system. I'll close this for now, but feel free to open a new issue if you encounter further dramas that you suspect relate to the package itself.

from easysnmp.

nnathan avatar nnathan commented on May 22, 2024

I have been experiment with running easysnmp on OSX where the original problem manifested.

The fix is actually incredibly simple and requires a slight modification of setup.py in how it parses the net-snmp-config --libs output. I also want to make sure the full test suite runs correctly.

Once I have sorted this out, I will be happy to say that we do infact support Net-SNMP 5.6 which seems to ship with the latest versions of OSX (10.8, 10.9), and push out a new version.

So @mlammon: not sure if you're still interested, but bear with me :).

from easysnmp.

nnathan avatar nnathan commented on May 22, 2024

I ran the test suite against the local running snmpd agent which seems somewhat broken in OSX.

In OSX I would run: sudo -i snmpd -f -Le -d -C -cpwd/easysnmp/tests/snmpd.conf.

Followed by running py.test in the easysnmp directory.

These are the results:

Results (52.41s):
     151 passed
       6 failed
         - /Users/naveen/code/easysnmp/tests/test_easy.py:215: assert '.1.3.6.1.4.1.8072.3.2.255' == '.1.3.6.1.4.1.8072.3.2.10'
         - /Users/naveen/code/easysnmp/tests/test_easy.py:215: assert '.1.3.6.1.4.1.8072.3.2.255' == '.1.3.6.1.4.1.8072.3.2.10'
         - /Users/naveen/code/easysnmp/tests/test_easy.py:215: assert '.1.3.6.1.4.1.8072.3.2.255' == '.1.3.6.1.4.1.8072.3.2.10'
         - /Users/naveen/code/easysnmp/easysnmp/session.py:467: EasySNMPTimeoutError: timed out while connecting to remote host
         - /Users/naveen/code/easysnmp/easysnmp/session.py:467: EasySNMPTimeoutError: timed out while connecting to remote host

This seems to be an issue that's limited to OSX whereby the snmpd will segfault after an interface.walk() test is performed. Until we can get a multi-OS build running in travis, I don't think it is worth doing unit tests in OSX since the shipped version of snmpd seems broken. Having said that, I'm highly confident that easysnmp should work just as good as the Linux version, since the issue is with the daemon and not the client libraries.

I'm now closing this issue again, now that it has been sorted once and for all.

from easysnmp.

jdub982 avatar jdub982 commented on May 22, 2024

@normanuber Is there a way to permanently place /usr/local/lib/netsnmplib.so into the LD_LIBRARY_PATH?

Trying to avoid having to have LD_PRELOAD=/usr/local/lib/libnetsnmp.so python in the execution command for my script.

Thanks in advance.

from easysnmp.

xiaotuanyu120 avatar xiaotuanyu120 commented on May 22, 2024

@normanuber really the same ask like jdub982, how do we to load the correct /usr/local/lib/libnetsnmp.so permanently?

from easysnmp.

bdurant avatar bdurant commented on May 22, 2024

This issue happens on Red Hat Enterprise Linux Server release 6.6 (Santiago).

I have to manually do the following in order for easysnmp to work as expected:

$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.6 (Santiago)

$ /usr/local/bin/snmpget --version
NET-SNMP version: 5.7.3

$ /usr/local/bin/python3.6 -c 'import easysnmp'
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.6/site-packages/easysnmp/init.py", line 1, in
from .easy import ( # noqa
File "/usr/local/lib/python3.6/site-packages/easysnmp/easy.py", line 3, in
from .session import Session
File "/usr/local/lib/python3.6/site-packages/easysnmp/session.py", line 8, in
from . import interface
ImportError: /usr/local/lib/python3.6/site-packages/easysnmp/interface.cpython-36m-x86_64-linux-gnu.so: undefined symbol: netsnmp_transport_config_compare

$ export LD_PRELOAD=/usr/local/lib/libnetsnmp.so

$ /usr/local/bin/python3.6 -c 'import easysnmp'

Is this going to be fixed so that we don't have to depend on doing the LD_PRELOAD?

from easysnmp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.