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”.
-- 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
- In your Grafana Cloud stack, click Connections in the left-hand menu.
- Find OracleDB and click its tile to open the integration.
- Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send OracleDB metrics and logs to your Grafana Cloud instance.
- 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
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
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
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 theinstance
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
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 theinstance
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.
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”.
-- 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
- In your Grafana Cloud stack, click Connections in the left-hand menu.
- Find OracleDB and click its tile to open the integration.
- Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send OracleDB metrics and logs to your Grafana Cloud instance.
- 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.
Post-install configuration for the OracleDB integration
This integration supports metrics and logs from an OracleDB instance.
Enable the integration by adding the provided snippets to your agent configuration file.
If you want to show logs and metrics signals correlated in your dashboards, as a single pane of glass, ensure the following:
job
and instance
label values must match for metrics and logs scrape config in your agent configuration file.
job
label must be set to integrations/oracledb
(already configured in the snippets).
instance
label must be set to a value that uniquely identifies your OrableDB node. Please replace the default <your-instance-name>
value according to your environment - it should be set manually. Note that if you use localhost for multiple nodes, the dashboards will not be able to filter correctly by instance.
Configuration snippets for Grafana Agent
Below integrations
, insert the following lines and change the URLs according to your environment:
oracledb:
enabled: true
scrape_interval: 5m
scrape_timeout: 1m
scrape_integration: true
connection_string: 'oracle://user:password@localhost:1521/orcl.localnet' # replace with your connection string
max_idle_connections: 0
max_open_connections: 10
query_timeout: 5
relabel_configs:
- replacement: '<your-instance-name>'
target_label: instance
Below logs.configs.scrape_configs
, insert the following lines according to your environment.
- job_name: integrations/oracledb
static_configs:
- targets: [localhost]
labels:
instance: '<your-instance-name>'
job: integrations/oracledb
__path__: /u01/base/diag/rdbms/*/*/trace/alert_*.log # replace with your log path
pipeline_stages:
- multiline:
# match on timestamp. Format should be like '2023-01-20T09:38:23.454813-05:00'
# but feel free to modify to match your logs
firstline: '\d+-\d+-\d+T\d+:\d+:\d+.\d+-\d+:\d+'
Full example configuration for Grafana Agent
Refer to the following Grafana Agent configuration for a complete example that contains all the snippets used for the OracleDB integration. This example also includes metrics that are sent to monitor your Grafana Agent instance.
integrations:
prometheus_remote_write:
- basic_auth:
password: <your_prom_pass>
username: <your_prom_user>
url: <your_prom_url>
agent:
enabled: true
relabel_configs:
- action: replace
source_labels:
- agent_hostname
target_label: instance
- action: replace
target_label: job
replacement: "integrations/agent-check"
metric_relabel_configs:
- action: keep
regex: (prometheus_target_sync_length_seconds_sum|prometheus_target_scrapes_.*|prometheus_target_interval.*|prometheus_sd_discovered_targets|agent_build.*|agent_wal_samples_appended_total|process_start_time_seconds)
source_labels:
- __name__
# Add here any snippet that belongs to the `integrations` section.
# For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
oracledb:
enabled: true
scrape_interval: 5m
scrape_timeout: 1m
scrape_integration: true
connection_string: 'oracle://user:password@localhost:1521/orcl.localnet' # replace with your connection string
max_idle_connections: 0
max_open_connections: 10
query_timeout: 5
relabel_configs:
- replacement: '<your-instance-name>'
target_label: instance
logs:
configs:
- clients:
- basic_auth:
password: <your_loki_pass>
username: <your_loki_user>
url: <your_loki_url>
name: integrations
positions:
filename: /tmp/positions.yaml
scrape_configs:
# Add here any snippet that belongs to the `logs.configs.scrape_configs` section.
# For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
- job_name: integrations/oracledb
static_configs:
- targets: [localhost]
labels:
instance: '<your-instance-name>'
job: integrations/oracledb
__path__: /u01/base/diag/rdbms/*/*/trace/alert_*.log # replace with your log path
pipeline_stages:
- multiline:
# match on timestamp. Format should be like '2023-01-20T09:38:23.454813-05:00'
# but feel free to modify to match your logs
firstline: '\d+-\d+-\d+T\d+:\d+:\d+.\d+-\d+:\d+'
metrics:
configs:
- name: integrations
remote_write:
- basic_auth:
password: <your_prom_pass>
username: <your_prom_user>
url: <your_prom_url>
scrape_configs:
# Add here any snippet that belongs to the `metrics.configs.scrape_configs` section.
# For a correct indentation, paste snippets copied from Grafana Cloud at the beginning of the line.
global:
scrape_interval: 60s
wal_directory: /tmp/grafana-agent-wal
Dashboards
The OracleDB integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.
- OracleDB overview
OracleDB overview dashboard
Alerts
The OracleDB integration includes the following useful alerts:
Alert | Description |
---|---|
OracledbReachingSessionLimit | Critical: The number of sessions being utilized exceeded 85%. |
OracledbReachingProcessLimit | Critical: The number of processess being utilized exceeded the threshold of 85%. |
OracledbTablespaceReachingCapacity | Critical: 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
# 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.