OracleDB plugin not evaluating environment variables

Suggested template:

Problem/Question

OracleDB plugin fails to run because it lacks environment variables. Following the guide for the oracledb collector, running ./python.d.plugin oracledb debug trace fails with DPI-1047: Cannot locate a 64-bit Oracle Client library: "libclntsh.so: cannot open shared object file: No such file or directory". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help. However if I run
export ORACLE_HOME=/oracle/product/19.3.0/dbhome_1 export LD_LIBRARY_PATH=$ORACLE_HOME/lib and the collector connects as expected. It appears the netdata user does not have a bashrc or bash_profile OR read from /etc/profile(.d)/ and it also does not reference the [environment variables] section in netdata.conf. This issue was brought up in the below referenced git issue, but was closed with no conversation.

Relevant docs you followed/actions you took to solve the issue

Environment/Browser/Agent’s version etc

Netdata Agent: 1.39.1

`
uname -a

Linux oracletest2.hcmsgroup.com 4.14.35-2047.522.3.el7uek.x86_64 #2 SMP Fri Jan 20 16:05:02 PST 2023 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/os-release

NAME=“Oracle Linux Server”
VERSION=“7.9”
ID=“ol”
ID_LIKE=“fedora”
VARIANT=“Server”
VARIANT_ID=“server”
VERSION_ID=“7.9”
PRETTY_NAME=“Oracle Linux Server 7.9”
`

What I expected to happen

Plugin works

Hi, @bergc. We recently added support for python-oracledb. This change is in the nightly version. If you are using nightly - consider switching to python-oracledb.

Hey @ilyam8, thanks for the quick response!
Can I switch from the stable to nightly release without reinstalling? And when do you expect these changes to hit stable? We are testing to implement in more critical systems and I would really like to stay on stable if at all possible. Is there any documentation about setting up python-oracledb? I don’t see anything in the linked issue.

You can just download the latest oracledb.chart.py and replace the old file with the new one (see the /usr/libexec/netdata/python.d/ dir).

Is there any documentation about setting up python-oracledb?

Yes, Installing python-oracledb.

Ok it looks like we got the plugin working however oracledb.chart.py will only use tcps and we had to modify line 341 to support a tcp connection. It would be nice to be able to specify the connection type in the config.

Ok, made a PR that adds the protocol config option. The default is tcps.

Awesome, thanks! We also noted the plugin only appears to process the first job if multiple are defined. Running ./python.d.plugin oracledb debug trace produces:

2023-05-26 07:51:11: python.d DEBUG: plugin[main] : [oracledb] loading '/opt/netdata/etc/netdata/python.d/oracledb.conf' 2023-05-26 07:51:11: python.d DEBUG: plugin[main] : [oracledb] '/opt/netdata/etc/netdata/python.d/oracledb.conf' is loaded 2023-05-26 07:51:11: python.d INFO: plugin[main] : [oracledb] built 3 job(s) configs 2023-05-26 07:51:11: python.d DEBUG: plugin[main] : oracledb[CDB] was previously active, applying recovering settings 2023-05-26 07:51:11: python.d DEBUG: plugin[main] : oracledb[WEBDB] was previously active, applying recovering settings 2023-05-26 07:51:11: python.d DEBUG: plugin[main] : oracledb[WEB_WKP] was previously active, applying recovering settings

But if you watch the output of the plugin it only ever gathers oracledb[CDB] and the cloud site only shows one oracledb entry with no indication of the job name or which db metrics it’s showing.