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 ?
Did you declare all the required modules in your plugin.json file before you build it?
Dynatrace is not using the local python installation, so all the modules need to be available on the one that Dynatrace is using.
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.
Validate that all the required modules are in your plugin folder located at /opt/dynatrace/remotepluginmodule/plugin_deployment/
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 found dynatrace plugin can't recognise anything outside the plugin folder (or outside of oneagent/agent folder), in my case, i copied the .so library into plugin folder then it was able to find it.
I now have new issues, but hope above helps resolve yours.
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?
You have already installed the library on the host, you now could execute the export (environment variable) in your python code. It is workaround.
os.environ["My_DATA"] = "my_export"
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.