Enigma
Enigma

Reputation: 71

External command error: /usr/local/bin/snmpget: error while loading shared libraries: libnetsnmp.so.20: cannot open shared object file

I'm able to do a snmpget/snmpwalk and check_snmp through command line. But, when I do it through Nagios (creating a host & services entry in the config files), I see this error in the "Status Information" of the services under specific host:

External command error: /usr/local/bin/snmpget: error while loading shared libraries: libnetsnmp.so.20: cannot open shared object file: No such file or directory

OS: SLES 11

Upvotes: 3

Views: 25474

Answers (3)

Ouali Abdelkader
Ouali Abdelkader

Reputation: 41

Even if you add the library path to the environment variable LD_LIBRARY_PATH, your programe cann't figure out the location of desired libraries as they are not yet exported. you can think of it as you draw a map to trace something, and forget to put the map into your bag, so when you begin searching, you don't know where the goddamn thing is located. The clue is to export them (locations). How ? simply, using the keyword export before any changes of the environment variable, like : export LD_LIBRARY_PATH=/your/libraries/location/:$LD_LIBRARY_PATH

and that's it ;-)

Cheers

Upvotes: 0

gangadhars
gangadhars

Reputation: 2728

The below procedure is helpful, if libnetsnmp.so.XX is in your system.

First search for library libnetsnmp.so.XX

sudo find / -name libnetsnmp.so*

So you will get output like below

/usr/lib/libnetsnmp.so.30
/usr/lib/libnetsnmp.so.15
/usr/lib/libnetsnmp.so.15.1.2
/usr/local/lib/libnetsnmp.so.30
/usr/local/lib/libnetsnmp.so
/usr/local/lib/libnetsnmp.so.30.0.2
/usr/local/lib/libnetsnmp.so.20
...

Now link that libnetsnmp.so.XX to /usr/lib/

sudo ln -s /usr/local/lib/libnetsnmp.so.XX /usr/lib/libnetsnmp.so.XX

Upvotes: 10

Igor Chubin
Igor Chubin

Reputation: 64563

The program misses a library. You can find a list of libraries the program needs using ldd:

$ ldd /usr/local/bin/snmpget

You will see not found near the libraries that are missing.

When you where located libraries that snmget needs, and that is a special location (not /usr/lib and so on), you can added to LD_LIBRARY_PATH:

 $ LD_LIBRARY_PATH=/usr/local/path-to/lib ldd /usr/local/bin/snmpget

Upvotes: 0

Related Questions