Menu
Grafana Cloud

OracleDB integration for Grafana Cloud

OracleDB is an enterprise SQL Database system produced and marketed by Oracle Corporation. The OracleDB integration uses the Grafana Agent to collect metrics and alert logs for monitoring an OracleDB instance. Including metrics such as virtual memory usage, open file descriptors, sessions, processes, database wait times, and tablespace usage. It also includes monitoring the alert log of an OracleDB instance which contains valuable information for usage and operations of the instance.

This integration supports metrics provided by v0.0.1 of a third party OracleDB exporter, which is integrated into the Grafana Agent.

This integration includes 3 useful alerts and 1 pre-built dashboard to help monitor and visualize OracleDB metrics and logs.

Before you begin

In the agent configuration file, you must provide a connection string which has credentials with permissions to run queries.

To create a user with the SQL permissions required for the monitoring user “grafanau”.

sql
  -- Create the monitoring user "grafanau"
  CREATE USER grafanau IDENTIFIED BY <YOUR-PASSWORD>;

  -- Grant the "grafanau" user the required permissions
  GRANT CONNECT TO grafanau;
  GRANT SELECT ON SYS.GV_$RESOURCE_LIMIT to grafanau;
  GRANT SELECT ON SYS.V_$SESSION to grafanau;
  GRANT SELECT ON SYS.V_$WAITCLASSMETRIC to grafanau;
  GRANT SELECT ON SYS.GV_$PROCESS to grafanau;
  GRANT SELECT ON SYS.GV_$SYSSTAT to grafanau;
  GRANT SELECT ON SYS.V_$DATAFILE to grafanau;
  GRANT SELECT ON SYS.V_$ASM_DISKGROUP_STAT to grafanau;
  GRANT SELECT ON SYS.V_$SYSTEM_WAIT_CLASS to grafanau;
  GRANT SELECT ON SYS.DBA_TABLESPACE_USAGE_METRICS to grafanau;
  GRANT SELECT ON SYS.DBA_TABLESPACES to grafanau;
  GRANT SELECT ON SYS.GLOBAL_NAME to grafanau;

Install OracleDB integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find OracleDB and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send OracleDB metrics and logs to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboard and alerts to your Grafana Cloud instance, and you can start monitoring your OracleDB setup.

Configuration snippets for Grafana Alloy

Simple mode

These snippets are configured to scrape a single OracleDB instance running locally with default ports.

First, manually copy and append the following snippets into your alloy configuration file.

Integrations snippets

alloy
prometheus.exporter.oracledb "integrations_oracledb" {
	connection_string = "oracle://user:password@localhost:1521/orcl.localnet"
}

discovery.relabel "integrations_oracledb" {
	targets = prometheus.exporter.oracledb.integrations_oracledb.targets

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}

	rule {
		target_label = "job"
		replacement  = "integrations/oracledb"
	}
}

prometheus.scrape "integrations_oracledb" {
	targets         = discovery.relabel.integrations_oracledb.output
	forward_to      = [prometheus.remote_write.metrics_service.receiver]
	job_name        = "integrations/oracledb"
	scrape_interval = "5m0s"
	scrape_timeout  = "1m0s"
}

Logs snippets

linux

alloy
local.file_match "logs_integrations_integrations_oracledb" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/u01/base/diag/rdbms/*/*/trace/alert_*.log",
		instance    = constants.hostname,
		job         = "integrations/oracledb",
	}]
}

loki.process "logs_integrations_integrations_oracledb" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "\\d+-\\d+-\\d+T\\d+:\\d+:\\d+.\\d+-\\d+:\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

loki.source.file "logs_integrations_integrations_oracledb" {
	targets    = local.file_match.logs_integrations_integrations_oracledb.targets
	forward_to = [loki.process.logs_integrations_integrations_oracledb.receiver]
}

Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your OracleDB instances, manually copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

Advanced integrations snippets

alloy
prometheus.exporter.oracledb "integrations_oracledb" {
	connection_string = "oracle://user:password@localhost:1521/orcl.localnet"
}

discovery.relabel "integrations_oracledb" {
	targets = prometheus.exporter.oracledb.integrations_oracledb.targets

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}

	rule {
		target_label = "job"
		replacement  = "integrations/oracledb"
	}
}

prometheus.scrape "integrations_oracledb" {
	targets         = discovery.relabel.integrations_oracledb.output
	forward_to      = [prometheus.remote_write.metrics_service.receiver]
	job_name        = "integrations/oracledb"
	scrape_interval = "5m0s"
	scrape_timeout  = "1m0s"
}

This integrations uses the prometheus.exporter.oracledb component to generate metrics from a OracleDB instance.

For the full array of configuration options, refer to the prometheus.exporter.oracledb component reference documentation.

This exporter must be linked with a discovery.relabel component to apply the necessary relabelings.

For each OracleDB instance to be monitored you must create a pair of these components.

Configure the following properties within each discovery.relabel component:

  • instance label: constants.hostname sets the instance label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this OracleDB instance. Make sure this label value is the same for all telemetry data collected for this instance.

You can then scrape them by including each discovery.relabel under targets within the prometheus.scrape component.

Advanced logs snippets

linux

alloy
local.file_match "logs_integrations_integrations_oracledb" {
	path_targets = [{
		__address__ = "localhost",
		__path__    = "/u01/base/diag/rdbms/*/*/trace/alert_*.log",
		instance    = constants.hostname,
		job         = "integrations/oracledb",
	}]
}

loki.process "logs_integrations_integrations_oracledb" {
	forward_to = [loki.write.grafana_cloud_loki.receiver]

	stage.multiline {
		firstline     = "\\d+-\\d+-\\d+T\\d+:\\d+:\\d+.\\d+-\\d+:\\d+"
		max_lines     = 0
		max_wait_time = "3s"
	}
}

loki.source.file "logs_integrations_integrations_oracledb" {
	targets    = local.file_match.logs_integrations_integrations_oracledb.targets
	forward_to = [loki.process.logs_integrations_integrations_oracledb.receiver]
}

To monitor your OracleDB instance logs, you will use a combination of the following components:

  • local.file_match defines where to find the log file to be scraped. Change the following properties according to your environment:

    • __address__: The OracleDB instance address
    • __path__: The path to the log file.
    • instance label: constants.hostname sets the instance label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this OracleDB instance. Make sure this label value is the same for all telemetry data collected for this instance.
  • loki.process defines how to process logs before sending it to Loki.

  • loki.source.file sends logs to Loki.

Grafana Agent static configuration (deprecated)

The following section shows configuration for running Grafana Agent in static mode which is deprecated. You should use Grafana Alloy for all new deployments.

Dashboards

The OracleDB integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

  • OracleDB overview

OracleDB overview dashboard

OracleDB overview dashboard

Alerts

The OracleDB integration includes the following useful alerts:

AlertDescription
OracledbReachingSessionLimitCritical: The number of sessions being utilized exceeded 85%.
OracledbReachingProcessLimitCritical: The number of processess being utilized exceeded the threshold of 85%.
OracledbTablespaceReachingCapacityCritical: A tablespace is exceeding more than 85% of its maximum allotted space.

Metrics

The most important metrics provided by the OracleDB integration, which are used on the pre-built dashboard and Prometheus alerts, are as follows:

  • oracledb_resource_current_utilization
  • oracledb_resource_limit_value
  • oracledb_tablespace_bytes
  • oracledb_tablespace_free
  • oracledb_tablespace_max_bytes
  • oracledb_up
  • oracledb_wait_time_application
  • oracledb_wait_time_commit
  • oracledb_wait_time_concurrency
  • oracledb_wait_time_configuration
  • oracledb_wait_time_network
  • oracledb_wait_time_scheduler
  • oracledb_wait_time_system_io
  • oracledb_wait_time_user_io
  • up

Changelog

md
# 0.0.4 - April 2024
* Added cluster selector to dashboards for kubernetes support
* Added default cluster label to agent config
* Bump version to 0.0.4

# 0.0.3 - September 2023

* New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working.
* New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label.

# 0.0.2 - August 2023

* Add regex filter for logs datasource

# 0.0.1 - February 2023

* Initial release

Cost

By connecting your OracleDB instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.