Showing results for 
Show  only  | Search instead for 
Did you mean: 

OneAgent SDK for Python on Openshift PaaS mode

DynaMight Champion
DynaMight Champion

Hello Community,

I'm trying to find out how one can use the oneagent SKD to get visibility into a python application that runs within a OpenShift container where the agent is deployed in PaaS mode.

We are using the pod-runtime injection as described here. As for the technology we have sed "all" so that would include the "sdk" option as well. The SDK is installed within the container also.

When the python process starts it's logging the following:

2020-11-03 12:46:47,644             INFO  main.init    Initializing...
2020-11-03 12:46:47,648             DEBUG  __init__.initialize    initialize: ref count = 0
2020-11-03 12:46:47,648             INFO  __init__._try_init_noref    Initializing SDK with options=['loglevelsdk=finest', 'loglevel=finest'], libname=None.
2020-11-03 12:46:47,940             INFO  sdkctypesiface.loadsdk    Loading native SDK library "/opt/app-root/lib/python3.6/site-packages/oneagent/_impl/native/".
2020-11-03 12:46:47,942             INFO  sdkctypesiface.__init__    Native SDK library "/opt/app-root/lib/python3.6/site-packages/oneagent/_impl/native/" version 1.5.1 loaded.
2020-11-03 12:46:47.943 UTC [adbdc85b] info    [onesdk] Initializing Dynatrace OneAgent SDK for C/C++ ...
2020-11-03 12:46:47.943 UTC [adbdc85b] info    [onesdk] SDK stub version, build date 2019.10.23 12:58:09.
2020-11-03 12:46:47.943 UTC [adbdc85b] fine    [onesdk] Preparing arguments...
2020-11-03 12:46:47.943 UTC [adbdc85b] config  [onesdk]   Options:
2020-11-03 12:46:47.943 UTC [adbdc85b] config  [onesdk]     Agent active:  true
2020-11-03 12:46:47.943 UTC [adbdc85b] config  [onesdk]     Agent module:  ''
2020-11-03 12:46:47.943 UTC [adbdc85b] config  [onesdk]     SDK log level: finest 
2020-11-03 12:46:47.943 UTC [adbdc85b] config  [onesdk]   Additional options:
2020-11-03 12:46:47.943 UTC [adbdc85b] config  [onesdk]     loglevel=finest
2020-11-03 12:46:47.943 UTC [adbdc85b] config  [onesdk]     ONESDK_INTERNAL_CA627667445C40F0_INIT_FLAGS=1
2020-11-03 12:46:47.943 UTC [adbdc85b] fine    [onesdk] Loading agent module...
2020-11-03 12:46:47.944 UTC [adbdc85b] info    [onesdk] Could not load agent module for Dynatrace OneAgent SDK for C/C++: cannot open shared object file: No such file or directory
2020-11-03 12:46:47,944             ERROR  __init__._try_init_noref    Failed initializing agent.
Traceback (most recent call last):
  File "/opt/app-root/lib/python3.6/site-packages/oneagent/", line 271, in _try_init_noref
    nativeagent.checkresult(sdk, sdk.initialize(flags), 'onesdk_initialize_2')
  File "/opt/app-root/lib/python3.6/site-packages/oneagent/_impl/native/", line 43, in checkresult
    raise SDKError(error_code, msg + ': ' + emsg)
oneagent.common.SDKError: (-1342308345, 'onesdk_initialize_2: Could not load agent.')

The library file does exist at the path:

(app-root) sh-4.2$ env | grep LD_LIBRARY_PATH
(app-root) sh-4.2$ ls -al /opt/dynatrace/oneagent/agent/lib64/
-rwxr-xr-x. 1 1017970000 1017970000 6540848 Oct  1 10:57 /opt/dynatrace/oneagent/agent/lib64/

Also when directly starting the python process from the pod's commandline it also is found without any problems and the SDK is loaded.

I was wondering if maybe the environment is not set for the process user or permissions need to be modified, though everything looks correct there (see permissions above).

Any ideas maybe?



Certified Dynatrace Master, Dynatrace Partner -



did you make sure that the LD_PRELOAD environment variable is set as described here?


Yes the LD_PRELOAD is also set properly in the deployment configuration.

The strange part is that if a user runs the python script manually from the container terminal it doesn't complain at all, only when the process is started with the container launch it throws this error.

Could it be that for sdk usage the LD_PRELOAD should also be set to and not to

Certified Dynatrace Master, Dynatrace Partner -

Featured Posts