I developed a remote OneAgent plugin to fetch metrics from Oracle.
In the plugin Python I call the cx_Oracle library. When I built the plugin the following library is generated:
The code does not work because it does not know about libclntsh library.
How can I use the generated library?
I have declared all required modules in my plugin.json file before building it.
In my plugin, I making a call to an Oracle Database.
My plugin is not working at the line when I make call to the cx_Oracle library to open a connection to database :
error while loading shared libraries: libclntsh.so : cannot open shared object file: No such file or directory.
When I built my plugin I had all the required library generated in the /opt/dynatrace/remotepluginmodule/plugin_deployment/. In my case it was cx_Oracle.cpython-36m-x86_64-linux-gnu.so.
I'm trying to connect to mssql using pyodbc module and libmsodbcsql. I'm facing exactly the same issue as Fousseyni, the error msg is as below:
File "/opt/dynatrace/oneagent/plugin_deployment/custom.python.xxx_plugin/xxx_plugin.py", line 6, in <module>
ImportError: libodbc.so.2: cannot open shared object file: No such file or directory
I searched the internet, almost everyone say above error means python can't find libodbc.so.2, this library is provided by unixOdbc which I have installed on the oneagent host.
-rw-r--r-- 1 root root 436064 Dec 12 2016 libodbc.so.2.0.0
lrwxrwxrwx 1 root root 16 Dec 12 2016 libodbc.so.2 -> libodbc.so.2.0.0
My plugin_deployment structure looks like below:
-rw-r--r-- 1 root root 1189 Feb 7 08:00 query_collection.py
-rw-r--r-- 1 root root 684488 Feb 7 08:00 pyodbc.cpython-36m-x86_64-linux-gnu.so
drwxr-xr-x 9 root root 288 Feb 7 08:00 pyodbc-4.0.28.dist-info
-rwxr-xr-x 1 root root 3850 Feb 7 08:00 plugin.json
drwxr-xr-x 6 root root 192 Feb 7 08:00 msodbcsql17
-rwxr-xr-x 1 root root 2843 Feb 7 08:00 xxx_plugin.py
drwxr-xr-x 9 root root 288 Feb 7 08:00 xxx_plugin-1.0.dist-info
In plugin.json I have:
I can't add msodbcsql17 here as it's not a python module, nor can I include libodbc.so.2 as it's a system library.
How can we solve this problem?
Setting environ in python doesn't work for current process, correct me if I'm wrong. I even added the env variable manually and printed out in the python script, yet it still can't find the .so file.
It seems to me the oneagent built-in python doesn't look for os libraries in normal locations.