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

OneAgent SDK for Python on Openshift PaaS mode

r_weber
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/libonesdk_shared.so".
2020-11-03 12:46:47,942             INFO  sdkctypesiface.__init__    Native SDK library "/opt/app-root/lib/python3.6/site-packages/oneagent/_impl/native/libonesdk_shared.so" 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 1.5.1.4, 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:  'liboneagentloader.so'
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++: liboneagentloader.so: 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/__init__.py", 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/nativeagent.py", 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
LD_LIBRARY_PATH=/opt/rh/rh-python36/root/usr/lib64:/opt/rh/rh-nodejs10/root/usr/lib64:/opt/rh/httpd24/root/usr/lib64:/opt/dynatrace/oneagent/agent/lib64/liboneagentloader.so
(app-root) sh-4.2$ ls -al /opt/dynatrace/oneagent/agent/lib64/liboneagentloader.so
-rwxr-xr-x. 1 1017970000 1017970000 6540848 Oct  1 10:57 /opt/dynatrace/oneagent/agent/lib64/liboneagentloader.so


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?

Thanks,

Reinhard

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net
2 REPLIES 2

wolfgangziegler
Inactive

Hi,

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


-Wolfgang

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 liboneagentloader.so and not to liboneagentproc.so?

Certified Dynatrace Master, Dynatrace Partner - 360Performance.net

Featured Posts