Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Oracle check to use python-oracledb library #13298

Merged
merged 39 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7775528
test
Kyle-Neale Nov 9, 2022
2895b9e
edit and fix tests
Kyle-Neale Nov 10, 2022
f625762
fixed error description
Kyle-Neale Nov 10, 2022
1ed0b99
style and remove pdb
Kyle-Neale Nov 10, 2022
5ef01f0
validate deps
Kyle-Neale Nov 10, 2022
6fcda84
remove py2 env
Kyle-Neale Nov 10, 2022
c0ef78a
remove ,
Kyle-Neale Nov 10, 2022
98c6a2a
fixed lone except
Kyle-Neale Nov 10, 2022
6fe79ca
small fix
Kyle-Neale Nov 11, 2022
8d0c721
tcps
Kyle-Neale Nov 18, 2022
fed5ed4
fix
Kyle-Neale Nov 22, 2022
c5e288c
fix
Kyle-Neale Nov 28, 2022
892377b
change readme
Kyle-Neale Nov 28, 2022
20df90e
Merge branch 'master' into Update-cx_Oracle
Kyle-Neale Nov 28, 2022
a8e4996
style fix
Kyle-Neale Nov 28, 2022
6b91f81
log line fix
Kyle-Neale Nov 28, 2022
83be57d
fix e2e
Kyle-Neale Nov 28, 2022
a47db91
fix e2e
Kyle-Neale Nov 28, 2022
f04ba0e
fix dependency mismatch
Kyle-Neale Nov 28, 2022
18fcbab
Update oracle/README.md
Kyle-Neale Nov 29, 2022
1304fe4
Update oracle/README.md
Kyle-Neale Nov 29, 2022
76ceac7
Update oracle/README.md
Kyle-Neale Nov 29, 2022
24531ad
Update oracle/README.md
Kyle-Neale Nov 29, 2022
4f1d144
edit and fix tests
Kyle-Neale Nov 10, 2022
dc8aafd
update docs
Kyle-Neale Nov 29, 2022
bfe5175
fix
Kyle-Neale Nov 29, 2022
e97c32c
fix
Kyle-Neale Nov 29, 2022
006c564
fix
Kyle-Neale Nov 29, 2022
27656a4
Update oracle/datadog_checks/oracle/oracle.py
Kyle-Neale Nov 30, 2022
ce8b8af
Update oracle/README.md
Kyle-Neale Nov 30, 2022
1bd8107
Update oracle/README.md
Kyle-Neale Nov 30, 2022
04789b0
Update oracle/datadog_checks/oracle/oracle.py
Kyle-Neale Nov 30, 2022
853f226
update docs
Kyle-Neale Nov 30, 2022
7a275b3
Update oracle/README.md
Kyle-Neale Dec 1, 2022
bc6139b
Update oracle/README.md
Kyle-Neale Dec 1, 2022
07324bc
fix
Kyle-Neale Dec 1, 2022
31a5bb7
add PY2 ConfigurationError
Kyle-Neale Dec 2, 2022
e43efce
Update oracle/README.md
Kyle-Neale Dec 2, 2022
8ba54a1
fix
Kyle-Neale Dec 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ clickhouse-driver,PyPI,MIT,Konstantin Lebedev
contextlib2,PyPI,PSF,Nick Coghlan
cryptography,PyPI,Apache-2.0,The Python Cryptographic Authority and individual contributors | The cryptography developers
cryptography,PyPI,BSD-3-Clause,The Python Cryptographic Authority and individual contributors | The cryptography developers
cx-Oracle,PyPI,BSD-3-Clause,""Anthony Tuininga", | Anthony Tuininga"
ddtrace,PyPI,BSD-3-Clause,"Datadog, Inc."
dnspython,PyPI,ISC,Bob Halley
enum34,PyPI,BSD-3-Clause,Ethan Furman
Expand All @@ -45,6 +44,8 @@ lz4,PyPI,BSD-3-Clause,Jonathan Underwood
mmh3,PyPI,CC0-1.0,Hajime Senuma
oauthlib,PyPI,BSD-3-Clause,The OAuthlib Community
openstacksdk,PyPI,Apache-2.0,OpenStack
oracledb,PyPI,Apache-2.0,Anthony Tuininga
oracledb,PyPI,UPL,Anthony Tuininga
orjson,PyPI,Apache-2.0,ijl <[email protected]>
orjson,PyPI,MIT,ijl <[email protected]>
packaging,PyPI,Apache-2.0,Donald Stufft and individual contributors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ clickhouse-driver==0.2.3; python_version > '3.0'
contextlib2==0.6.0.post1; python_version < '3.0'
cryptography==3.3.2; python_version < '3.0'
cryptography==38.0.3; python_version > '3.0'
cx-oracle==7.3.0; python_version < '3.0'
cx-oracle==8.3.0; python_version > '3.0'
ddtrace==0.32.2; sys_platform == 'win32' and python_version < '3.0'
ddtrace==0.53.2; sys_platform != 'win32' or python_version > '3.0'
dnspython==1.16.0
Expand All @@ -34,7 +32,6 @@ in-toto==1.0.1
ipaddress==1.0.23; python_version < '3.0'
jaydebeapi==1.2.3
jellyfish==0.9.0; python_version > '3.0'
jpype1==0.7.0; python_version < '3.0'
jpype1==1.4.0; python_version > '3.0'
kafka-python==2.0.2
kazoo==2.9.0
Expand All @@ -50,6 +47,7 @@ oauthlib==3.1.0; python_version < '3.0'
oauthlib==3.2.2; python_version > '3.0'
openstacksdk==0.39.0; python_version < '3.0'
openstacksdk==0.61.0; python_version > '3.0'
oracledb==1.2.0; python_version >= '3.8'
orjson==3.8.1; python_version > '3.0'
packaging==20.9; python_version < '3.0'
packaging==21.3; python_version > '3.0'
Expand Down
157 changes: 32 additions & 125 deletions oracle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,11 @@ Get metrics from Oracle Database servers in real time to visualize and monitor a

#### Prerequisite

To use the Oracle integration, either install the Oracle Instant Client libraries, or download the Oracle JDBC driver (Linux only).
Due to licensing restrictions, these libraries are not included in the Datadog Agent, but can be downloaded directly from Oracle.
To use the Oracle integration you can either use the native client (no additional install steps required) or download the Oracle JDBC driver (Linux only). To use the Oracle integration with JDBC, download the Oracle JDBC driver. If not using the JDBC method, the minimun [supported version][2] is Oracle 12c.
Due to licensing restrictions, the JDBC library is not included in the Datadog Agent, but can be downloaded directly from Oracle.

##### Oracle Instant Client
**Note**: With Agent v7.42.x, the Agent uses `python-oracledb` thin mode which no longer requires installing the Instant Client libraries. If you're on an older version of the Agent and want to use the Instant Client, refer to the [Oracle Instant Client][3] setup instructions.
Kyle-Neale marked this conversation as resolved.
Show resolved Hide resolved

<!-- xxx tabs xxx -->
<!-- xxx tab "Linux" xxx -->
###### Linux

1. Follow the [Oracle Instant Client installation for Linux][2].

2. Verify the following:
- Both the *Instant Client Basic* and *SDK* packages are installed. Find them on Oracle's [download page][3].

After the Instant Client libraries are installed, ensure the runtime linker can find the libraries. For example, using `ldconfig`:

```shell
# Put the library location in an ld configuration file.

sudo sh -c "echo /usr/lib/oracle/12.2/client64/lib > \
/etc/ld.so.conf.d/oracle-instantclient.conf"

# Update the bindings.

sudo ldconfig
```

- Both packages are decompressed into a single directory that is available to all users on the given machine (for example, `/opt/oracle`):
```shell
mkdir -p /opt/oracle/ && cd /opt/oracle/
unzip /opt/oracle/instantclient-basic-linux.x64-12.1.0.2.0.zip
unzip /opt/oracle/instantclient-sdk-linux.x64-12.1.0.2.0.zip
```

<!-- xxz tab xxx -->
<!-- xxx tab "Windows" xxx -->
###### Windows

1. Follow the [Oracle Windows installation guide][4] to configure your Oracle Instant Client.

2. Verify the following:
- The [Microsoft Visual Studio 2017 Redistributable][5] or the appropriate version is installed for the Oracle Instant Client.

- Both the *Instant Client Basic* and *SDK* packages from Oracle's [download page][3] are installed.

- Both packages are extracted into a single directory that is available to all users on the given machine (for example, `C:\oracle`).


<!-- xxz tab xxx -->
<!-- xxz tabs xxx -->

##### JDBC driver

Expand All @@ -71,8 +26,8 @@ Java 8 or higher is required on your system for JPype, one of the libraries used

Once it is installed, complete the following steps:

1. [Download the JDBC Driver][6] JAR file.
2. Add the path to the downloaded file in your `$CLASSPATH` or the check configuration file under `jdbc_driver_path` (see the [sample oracle.yaml][7]).
1. [Download the JDBC Driver][4] JAR file.
2. Add the path to the downloaded file in your `$CLASSPATH` or the check configuration file under `jdbc_driver_path` (see the [sample oracle.yaml][5]).

#### Datadog user creation

Expand Down Expand Up @@ -131,7 +86,7 @@ GRANT SELECT ON gv_$sysmetric TO c##datadog CONTAINER=ALL;

To configure this check for an Agent running on a host:

1. Edit the `oracle.d/conf.yaml` file, in the `conf.d/` folder at the root of your [Agent's configuration directory][8]. Update the `server` and `port` to set the masters to monitor. See the [sample oracle.d/conf.yaml][7] for all available configuration options.
1. Edit the `oracle.d/conf.yaml` file, in the `conf.d/` folder at the root of your [Agent's configuration directory][6]. Update the `server` and `port` to set the masters to monitor. See the [sample oracle.d/conf.yaml][5] for all available configuration options.

```yaml
init_config:
Expand Down Expand Up @@ -159,7 +114,7 @@ To configure this check for an Agent running on a host:
password: <PASSWORD>
```

2. [Restart the Agent][9].
2. [Restart the Agent][7].


#### Only custom queries
Expand Down Expand Up @@ -242,9 +197,9 @@ instances:

2. Update the `sqlnet.ora`, `listener.ora`, and `tnsnames.ora` to allow TCPS connections on your Oracle Database.

##### TCPS through the Oracle Instant Client
##### TCPS through Oracle without JDBC

If you are connecting to Oracle Database using the Oracle Instant Client, verify that the Datadog Agent is able to connect to your database. Use the `sqlplus` command line tool with the information inputted in your configuration options:
If you are connecting to Oracle Database through Oracle, verify that the Datadog Agent is able to connect to your database. Use the `sqlplus` command line tool with the information inputted in your configuration options:
Kyle-Neale marked this conversation as resolved.
Show resolved Hide resolved
Kyle-Neale marked this conversation as resolved.
Show resolved Hide resolved

```shell
sqlplus <USER>/<PASSWORD>@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCPS)(HOST=<HOST>)(PORT=<PORT>))(SERVICE_NAME=<SERVICE_NAME>)))
Expand Down Expand Up @@ -276,14 +231,14 @@ If you are connecting to Oracle Database using JDBC, you also need to specify `j
# jdbc_truststore_password: <JDBC_TRUSTSTORE_PASSWORD>
```

For more information about connecting to the Oracle Database through TCPS on JDBC, see the official [Oracle whitepaper][17].
For more information about connecting to the Oracle Database through TCPS on JDBC, see the official [Oracle whitepaper][15].

<!-- xxz tab xxx -->
<!-- xxx tab "Containerized" xxx -->

#### Containerized

For containerized environments, see the [Autodiscovery Integration Templates][10] for guidance on applying the parameters below.
For containerized environments, see the [Autodiscovery Integration Templates][8] for guidance on applying the parameters below.

| Parameter | Value |
| -------------------- | --------------------------------------------------------------------------------------------------------- |
Expand All @@ -297,7 +252,7 @@ For containerized environments, see the [Autodiscovery Integration Templates][10

### Validation

[Run the Agent's status subcommand][11] and look for `oracle` under the Checks section.
[Run the Agent's status subcommand][9] and look for `oracle` under the Checks section.

## Custom query

Expand Down Expand Up @@ -339,7 +294,7 @@ is what the following example configuration would become:
- tester:oracle
```

See the [sample oracle.d/conf.yaml][7] for all available configuration options.
See the [sample oracle.d/conf.yaml][5] for all available configuration options.

### Example

Expand Down Expand Up @@ -403,71 +358,25 @@ SQL> select blocking_session,username,osuser, sid, serial#, wait_class, seconds_
where blocking_session is not NULL order by blocking_session;
```

3. Once configured, you can create a [monitor][12] based on `oracle.custom_query.locks` metrics.
3. Once configured, you can create a [monitor][10] based on `oracle.custom_query.locks` metrics.

## Data Collected

### Metrics

See [metadata.csv][13] for a list of metrics provided by this integration.
See [metadata.csv][11] for a list of metrics provided by this integration.

### Events

The Oracle Database check does not include any events.

### Service Checks

See [service_checks.json][14] for a list of service checks provided by this integration.
See [service_checks.json][12] for a list of service checks provided by this integration.
Kyle-Neale marked this conversation as resolved.
Show resolved Hide resolved

## Troubleshooting

### Common problems
#### Oracle Instant Client
- Verify that both the Oracle Instant Client and SDK files are located in the same directory.
The structure of the directory should look similar:

```text
|____sdk/
|____network/
|____libociei.dylib
|____libocci.dylib
|____libocci.dylib.10.1
|____adrci
|____uidrvci
|____libclntsh.dylib.19.1
|____ojdbc8.jar
|____BASIC_README
|____liboramysql19.dylib
|____libocijdbc19.dylib
|____libocci.dylib.19.1
|____libclntsh.dylib
|____xstreams.jar
|____libclntsh.dylib.10.1
|____libnnz19.dylib
|____libclntshcore.dylib.19.1
|____libocci.dylib.12.1
|____libocci.dylib.18.1
|____libclntsh.dylib.11.1
|____BASIC_LICENSE
|____SDK_LICENSE
|____libocci.dylib.11.1
|____libclntsh.dylib.12.1
|____libclntsh.dylib.18.1
|____ucp.jar
|____genezi
|____SDK_README

```

##### Linux
- See further Linux installation documentation on [Oracle][2].

##### Windows
- Verify the Microsoft Visual Studio `<YEAR>` Redistributable requirement is met for your version. See the [Windows downloads page][15] for more details.
- See further Windows installation documentation on [Oracle][4].


#### JDBC driver (Linux only)
### JDBC driver (Linux only)
- If you encounter a `JVMNotFoundException`:

```text
Expand All @@ -492,22 +401,20 @@ Ensure the displayed output matches the correct value.
sudo -u dd-agent -- /opt/datadog-agent/embedded/bin/python -c "import os; print(\"JAVA_HOME:{}\".format(os.environ.get(\"JAVA_HOME\")))"
```

Need help? Contact [Datadog support][16].
Need help? Contact [Datadog support][14].

[1]: https://raw.githubusercontent.com/DataDog/integrations-core/master/oracle/images/oracle_dashboard.png
[2]: https://docs.oracle.com/en/database/oracle/oracle-database/21/lacli/install-instant-client-using-zip.html
[3]: https://www.oracle.com/technetwork/database/features/instant-client/index.htm
[4]: https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html#ic_winx64_inst
[5]: https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
[6]: https://www.oracle.com/technetwork/database/application-development/jdbc/downloads/index.html
[7]: https://github.com/DataDog/integrations-core/blob/master/oracle/datadog_checks/oracle/data/conf.yaml.example
[8]: https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory
[9]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[10]: https://docs.datadoghq.com/agent/kubernetes/integrations/
[11]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information
[12]: https://docs.datadoghq.com/monitors/monitor_types/metric/?tab=threshold
[13]: https://github.com/DataDog/integrations-core/blob/master/oracle/metadata.csv
[14]: https://github.com/DataDog/integrations-core/blob/master/oracle/assets/service_checks.json
[15]: https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html
[16]: https://docs.datadoghq.com/help/
[17]: https://www.oracle.com/technetwork/topics/wp-oracle-jdbc-thin-ssl-130128.pdf
[2]: https://oracle.github.io/python-oracledb/
[3]: https://github.com/DataDog/integrations-core/tree/7.41.x/oracle#oracle-instant-client
[4]: https://www.oracle.com/technetwork/database/application-development/jdbc/downloads/index.html
[5]: https://github.com/DataDog/integrations-core/blob/master/oracle/datadog_checks/oracle/data/conf.yaml.example
[6]: https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory
[7]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent
[8]: https://docs.datadoghq.com/agent/kubernetes/integrations/
[9]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information
[10]: https://docs.datadoghq.com/monitors/monitor_types/metric/?tab=threshold
[11]: https://github.com/DataDog/integrations-core/blob/master/oracle/metadata.csv
[12]: https://github.com/DataDog/integrations-core/blob/master/oracle/assets/service_checks.json
[13]: https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html
[14]: https://docs.datadoghq.com/help/
[15]: https://www.oracle.com/technetwork/topics/wp-oracle-jdbc-thin-ssl-130128.pdf
Loading