Host Setupedit

Some drivers require additional configuration to work. Find here instructions for these drivers.

Oracle Database Connection Pre-requisitesedit

To get connected with the Oracle Database ORACLE_SID, ORACLE_BASE, ORACLE_HOME environment variables should be set.

For example: Let us consider Oracle Database 21c installation using RPM manually by following this link, environment variables should be set as follows:

export ORACLE_BASE=/opt/oracle/oradata
export ORACLE_HOME=/opt/oracle/product/21c/dbhome_1

Also, add ORACLE_HOME/bin to the PATH environment variable.

Oracle Instant Client Installationedit

Oracle Instant Client enables development and deployment of applications that connect to Oracle Database. The Instant Client libraries provide the necessary network connectivity and advanced data features to make full use of Oracle Database. If you have OCI Oracle server which comes with these libraries pre-installed, you don’t need a separate client installation.

The OCI library install few Client Shared Libraries that must be referenced on the machine where Metricbeat is installed. Please follow this link for OCI Instant Client set up. The OCI Instant Client is available with the Oracle Universal Installer, RPM file or ZIP file. Download links can be found here.

Enable Oracle Listeneredit

The Oracle listener is a service that runs on the database host and receives requests from Oracle clients. Make sure that listener should be running. To check if the listener is running or not, run:

lsnrctl STATUS

If the listener is not running, use the command to start:

lsnrctl START

Then, Metricbeat can be launched.

Host Configuration for Oracleedit

The following two types of host configurations are supported:

  1. DSN host configuration as URL:

    1. hosts: ["user/pass@"]
    2. hosts: ["user/password@ as sysdba"]
  2. DSN host configuration:

    1. hosts: ['user="user" password="pass" connectString=""']
    2. hosts: ['user="user" password="password" connectString="host:port/service_name" sysdba=true']

Note: If the password contains the backslash (\) character, it must be escaped with a backslash. For example, if the password is my\_password, it should be written as my\\_password.

Username and Password to connect to the database can be provided as values to username and password keys of sql.yml.

- module: sql
    - query
  period: 10s
  driver: "oracle"
  enabled: true
  hosts: ['user="" password="" connectString="" sysdba=true']
  username: sys
  password: password
    response_format: variables

Example configuration

The SQL module supports the standard configuration options that are described in Modules. Here is an example configuration:

- module: sql
    - query
  period: 10s
  hosts: ["user=myuser password=mypassword dbname=mydb sslmode=disable"]

  driver: "postgres"
  sql_query: "select now()"
  sql_response_format: table


The following metricsets are available: