This page describes how to set up an OracleDB exporter in order to gather metrics regarding an Oracle Database instance through the Prometheus provider.
Installation
The OracleDB exporter repository is available on the official project page. The suggested deploy mode is through a Docker image, since the Prometheus instance can easily access the running container through the Akamas network.
Use the following command line to run the container, where cust-metrics.toml is your configuration file defining the queries for additional custom metrics (see paragraph below) and DATA_SOURCE_NAME an environment variable containing the Oracle EasyConnect string:
You can refer to the official guide for more details or alternative deployment modes.
Custom queries
It is possible to define additional queries to expose custom metrics using any data in the database instance that is readable by the monitoring user (see the guide for more details about the syntax).
Custom Configuration file
The following is an example of exporting system metrics from the Dynamic Performance (V$) Views used by the Prometheus provider default queries for the Oracle Database optimization pack:
[[metric]]context="memory"labels= [ "component" ]metricsdesc= { size="Component memory extracted from v$memory_dynamic_components in Oracle." }request ='''SELECT component, current_size as "size"FROM V$MEMORY_DYNAMIC_COMPONENTSUNIONSELECT name, bytes as "size"FROM V$SGAINFOWHERE name in ('Free SGA Memory Available', 'Redo Buffers', 'Maximum SGA Size')'''[[metric]]context ="activity"metricsdesc = { value="Generic counter metric from v$sysstat view in Oracle." }fieldtoappend ="name"request ='''SELECT name, valueFROM V$SYSSTAT WHERE name IN ( 'execute count', 'user commits', 'user rollbacks', 'db block gets from cache', 'consistent gets from cache', 'physical reads cache', /* CACHE */ 'redo log space requests' ) '''[[metric]]context ="system_event"labels = [ "event","wait_class" ]request ='''SELECT event, wait_class, total_waits, time_waitedFROM V$SYSTEM_EVENT'''[metric.metricsdesc] total_waits="Total number of waits for the event as per V$SYSTEM_EVENT in Oracle." time_waited="Total time waited for the event (in hundredths of seconds) as per V$SYSTEM_EVENT in Oracle."