### Example Configuration File for Oracle DB Exporter Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/docs/getting-started/basics.md This YAML file provides an example of how to configure the Oracle Database Metrics Exporter. It demonstrates how environment variables can be used for parameter expansion and includes notes on escaping special characters like the dollar sign. This format is preferred over command-line arguments for configuration. ```yaml # Example Oracle Database Metrics Exporter Configuration file. # Environment variables of the form ${VAR_NAME} will be expanded. # If you include a config value that contains a '$' character, escape that '$' with another '$', e.g., # "$test$pwd" => "$$test$$pwd" # Otherwise, the value will be expanded as an environment variable. # Example Oracle Database Metrics Exporter Configuration file. ``` -------------------------------- ### Setup Docker Compose Environment for Oracle DB AppDev Monitoring Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/docs/docs/next/getting-started/basics/index.html This command-line snippet demonstrates how to navigate to the Docker Compose directory and start the necessary services for a test environment. It includes Oracle Database, the exporter, Prometheus, and Grafana. The initial startup of the Oracle container may take longer due to database instance creation. ```shell cd docker-composedocker-compose up -d ``` -------------------------------- ### Start Local Development Server (Bash) Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/README.md Starts a local development server for the website. This command automatically opens the site in a browser and enables live reloading for most changes. ```bash npm start ``` -------------------------------- ### Install Build Tools | apt-get Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/docs/docs/next/releases/builds/index.html Installs necessary build tools on a Ubuntu Linux system. Podman and qemu-user-static are only required for container builds. ```bash sudo apt-get -y install podman qemu-user-static golang gcc-aarch64-linux-gnu ``` -------------------------------- ### Start Docker Compose Environment Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/docs/docs/2.0.3/getting-started/basics/index.html This command initiates the Docker containers defined in the docker-compose.yml file, setting up an Oracle Database, the exporter, Prometheus, and Grafana. Ensure you are in the 'docker-compose' directory before running. ```shell cd docker-compose docker-compose up -d ``` -------------------------------- ### Install Dependencies (Bash) Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/README.md Installs project dependencies using npm. Ensure you have the latest version of NodeJS installed. ```bash npm ``` -------------------------------- ### Containerizing Oracle DB Metrics Exporter with Custom Config Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/docs/docs/2.0.3/configuration/config-file/index.html This Dockerfile example demonstrates how to build a container image for the Oracle Database Metrics Exporter. It copies a custom configuration file into the image and sets the entrypoint to run the exporter with the specified configuration. ```dockerfile FROM container-registry.oracle.com/database/observability-exporter:2.0.3 COPY my-exporter-config.yaml /my-exporter-config.yaml ENTRYPOINT ["/oracledb_exporter", "--config.file", "/my-exporter-config.yaml"] ``` -------------------------------- ### Example Static Credential Configuration Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/docs/configuration/hashicorp-vault.md An example illustrating the configuration of a database named 'mydb' to retrieve credentials from HashiCorp Vault using the 'kvv2' mount type and a specific secret path. ```yaml databases: mydb: vault: hashicorp: proxySocket: /var/run/vault/vault.sock mountType: kvv2 mountName: dev secretPath: oracle/mydb/monitoring ``` -------------------------------- ### Customize Metrics in Container Image with Dockerfile Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/docs/docs/2.1.0/configuration/custom-metrics/index.html This Dockerfile example demonstrates how to build a custom container image for the observability exporter with custom metrics included. It copies a TOML configuration file into the image and sets the entrypoint to include the custom metrics flag. ```dockerfile FROM container-registry.oracle.com/database/observability-exporter:2.1.0 COPY custom-metrics.toml /ENTRYPOINT ["/oracledb_exporter", "--custom.metrics", "/custom-metrics.toml"] ``` -------------------------------- ### Check Oracle DB Exporter Database Connection Status Source: https://context7.com/oracle/oracle-db-appdev-monitoring/llms.txt This bash command retrieves the 'oracledb_up' metric from the oracledb_exporter via curl. This metric indicates the connectivity status of the monitored Oracle databases. The output example shows how it might appear for a multi-database setup. ```bash # Check database up status curl -s http://localhost:9161/metrics | grep oracledb_up # Output for multi-database setup: # oracledb_up{database="production-db",environment="production"} 1 # oracledb_up{database="staging-db",environment="staging"} 1 # oracledb_up{database="test-db",environment="test"} 0 ``` -------------------------------- ### Configure Oracle Database Connection Details Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/versioned_docs/version-2.0.3/getting-started/basics.md Defines the connection parameters for an Oracle database instance. This includes credentials, connection URL, query timeout, and pooling settings. Environment variables are supported for sensitive information like username and password. Metrics scraping and logging configurations are also specified. ```yaml databases: default: username: ${DB_USERNAME} password: ${DB_PASSWORD} url: localhost:1521/freepdb1 queryTimeout: 5 maxOpenConns: 10 maxIdleConns: 10 metrics: default: default-metrics.toml custom: - custom-metrics-example/custom-metrics.toml log: destination: /opt/alert.log interval: 15s ``` -------------------------------- ### Basic Configuration File Setup (YAML) Source: https://context7.com/oracle/oracle-db-appdev-monitoring/llms.txt Defines the fundamental structure for the exporter's configuration file. It specifies database connection parameters, metrics collection settings, and alert log export configurations. ```yaml databases: metricsPath: /metrics default: username: ${DB_USERNAME} password: ${DB_PASSWORD} url: localhost:1521/freepdb1 queryTimeout: 5 externalAuth: false role: SYSDBA tnsAdmin: /path/to/database/wallet maxOpenConns: 10 maxIdleConns: 10 poolIncrement: 1 poolMaxConnections: 15 poolMinConnections: 15 metrics: scrapeInterval: 15s default: default-metrics.toml custom: - custom-metrics-example/custom-metrics.toml log: destination: /opt/alert.log interval: 15s disable: 0 ``` -------------------------------- ### Build Binaries using Make - Go Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/docs/docs/2.1.0/advanced/development/index.html This command initiates the build process for creating executable binaries and archives for the current operating system. The output is placed in the 'dist' directory. Ensure you have the Go toolchain installed. ```bash make go-build ``` -------------------------------- ### Install Build Tools on Oracle Linux Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/docs/releases/builds.md Installs essential build tools including Git, Go, and Make on an Oracle Linux system. These tools are required for cloning the repository and building the exporter. ```bash dnf install -y git golang make ``` -------------------------------- ### Running the Exporter as a Standalone Binary (Bash) Source: https://context7.com/oracle/oracle-db-appdev-monitoring/llms.txt Provides instructions for running the exporter directly from a compiled binary. This approach allows for fine-grained control over command-line flags for configuration parameters. ```bash ./oracledb_exporter \ --config.file=config.yaml \ --web.telemetry-path=/metrics \ --default.metrics=default-metrics.toml \ --custom.metrics=custom-metrics.toml \ --query.timeout=5 \ --database.maxIdleConns=10 \ --database.maxOpenConns=10 \ --scrape.interval=15s \ --log.interval=15s \ --log.destination=/var/log/alert.log ``` -------------------------------- ### Example Exporter Configuration (YAML) Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/docs/configuration/config-file.md This is an example of the exporter configuration file in YAML format. It demonstrates how to set up database connection details, metrics paths, and logging configurations. Environment variables can be used for sensitive information like usernames and passwords. ```yaml # Example Oracle Database Metrics Exporter Configuration file. # Environment variables of the form ${VAR_NAME} will be expanded. # If you include a config value that contains a '$' character, escape that '$' with another '$', e.g., # "$test$pwd" => "$$test$$pwd" # Otherwise, the value will be expanded as an environment variable. # Example Oracle Database Metrics Exporter Configuration file. # Environment variables of the form ${VAR_NAME} will be expanded. databases: ## Path on which metrics will be served # metricsPath: /metrics ## Database connection information for the "default" database. default: ## Database username username: ${DB_USERNAME} ## Database password password: ${DB_PASSWORD} ## Database password file ## If specified, will load the database password from a file. # passwordFile: ${DB_PASSWORD_FILE} ## Database connection url url: localhost:1521/freepdb1 ## Metrics query timeout for this database, in seconds queryTimeout: 5 ## Rely on Oracle Database External Authentication by network or OS # externalAuth: false ## Database role # role: SYSDBA ## Path to Oracle Database wallet, if using wallet # tnsAdmin: /path/to/database/wallet ### Connection settings: ### Either the go-sql or Oracle Database connection pool may be used. ### To use the Oracle Database connection pool over the go-sql connection pool, ### set maxIdleConns to zero and configure the pool* settings. ### Connection pooling settings for the go-sql connection pool ## Max open connections for this database using go-sql connection pool maxOpenConns: 10 ## Max idle connections for this database using go-sql connection pool maxIdleConns: 10 ### Connection pooling settings for the Oracle Database connection pool ## Oracle Database connection pool increment. # poolIncrement: 1 ## Oracle Database Connection pool maximum size # poolMaxConnections: 15 ## Oracle Database Connection pool minimum size # poolMinConnections: 15 ## Arbitrary labels to add to each metric scraped from this database # labels: # label_name1: label_value1 # label_name2: label_value2 metrics: ## How often to scrape metrics. If not provided, metrics will be scraped on request. # scrapeInterval: 15s ## Path to default metrics file. default: default-metrics.toml ## Paths to any custom metrics files custom: - custom-metrics-example/custom-metrics.toml log: # Path of log file destination: /opt/alert.log # Interval of log updates interval: 15s ## Set disable to 1 to disable logging # disable: 0 # Optionally configure prometheus webserver #web: # listenAddresses: [':9161'] # systemdSocket: true|false # configFile: /path/to/webconfigfile ``` -------------------------------- ### Standalone Binary Usage and Configuration Options Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/docs/docs/getting-started/basics/index.html This showcases the command-line arguments for the standalone Oracle DB AppDev Monitoring Exporter binary. It includes options for configuration files, metrics paths, custom metrics, timeouts, connection pool settings, and logging. The `--help` flag provides a comprehensive list of all available arguments. ```bash Usage of oracledb_exporter: --config.file="example-config.yaml" File with metrics exporter configuration. (env: CONFIG_FILE) --web.telemetry-path="/metrics" Path under which to expose metrics. (env: TELEMETRY_PATH) --default.metrics="default-metrics.toml" File with default metrics in a TOML file. (env: DEFAULT_METRICS) --custom.metrics="" Comma separated list of file(s) that contain various custom metrics in a TOML format. (env: CUSTOM_METRICS) --query.timeout=5 Query timeout (in seconds). (env: QUERY_TIMEOUT) --database.maxIdleConns=0 Number of maximum idle connections in the connection pool. (env: DATABASE_MAXIDLECONNS) --database.maxOpenConns=10 Number of maximum open connections in the connection pool. (env: DATABASE_MAXOPENCONNS) --database.poolIncrement=-1 Connection increment when the connection pool reaches max capacity. (env: DATABASE_POOLINCREMENT) --database.poolMaxConnections=-1 Maximum number of connections in the connection pool. (env: DATABASE_POOLMAXCONNECTIONS) --database.poolMinConnections=-1 Minimum number of connections in the connection pool. (env: DATABASE_POOLMINCONNECTIONS) --scrape.interval=0s Interval between each scrape. Default is to scrape on collect requests. --log.disable=0 Set to 1 to disable alert logs --log.interval=15s Interval between log updates (e.g. 5s). --log.destination="/log/alert.log" File to output the alert log to. (env: LOG_DESTINATION) --web.listen-address=:9161 ... Addresses on which to expose metrics and web interface. Repeatable for multiple addresses. Examples: `:9100` or `[::1]:9100` for http, `vsock://:9100` for vsock --web.config.file="" Path to configuration file that can enable TLS or authentication. See: https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md --log.level=info Only log messages with the given severity or above. One of: [debug, info, warn, error] --log.format=logfmt Output format of log messages. One of: [logfmt, json] --[no-]version Show application version. ``` -------------------------------- ### Prometheus Target Configuration Example Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/docs/getting-started/kubernetes.md An example Prometheus job definition to configure scraping metrics from the Oracle Database Observability exporter. This configuration specifies the job name, metrics path, scrape intervals, and the target endpoint for the exporter service within the Kubernetes cluster. ```yaml - job_name: 'oracle-exporter' metrics_path: '/metrics' scrape_interval: 15s scrape_timeout: 10s static_configs: - targets: - metrics-exporter.exporter.svc.cluster.local:9161 ``` -------------------------------- ### Running the Exporter with Docker (Bash) Source: https://context7.com/oracle/oracle-db-appdev-monitoring/llms.txt Demonstrates how to run the Oracle Database Metrics Exporter as a Docker container. This method simplifies deployment and management, using environment variables for sensitive information and volume mounts for configuration. ```bash docker run -d \ --name oracledb-exporter \ -p 9161:9161 \ -e DB_USERNAME=system \ -e DB_PASSWORD=oracle \ -e DB_CONNECT_STRING=localhost:1521/ORCLPDB1 \ -v $(pwd)/config.yaml:/config.yaml \ -v $(pwd)/wallet:/wallet \ ghcr.io/oracle/oracle-db-appdev-monitoring:latest \ --config.file=/config.yaml ``` -------------------------------- ### Example Combined tnsnames.ora for Multiple Databases Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/docs/docs/2.0.4/configuration/oracle-wallet/index.html An example of a combined tnsnames.ora file demonstrating how to include TNS aliases for multiple Oracle databases, each with its specific wallet directory configured for mTLS. This file consolidates connection information for different database instances. ```oracle-config db1_high = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.****.oraclecloud.com))(connect_data=(service_name=****.adb.oraclecloud.com))(security=(MY_WALLET_DIRECTORY=/wallets/db1)(ssl_server_dn_match=yes))) db2_high = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.****.oraclecloud.com))(connect_data=(service_name=****.adb.oraclecloud.com))(security=(MY_WALLET_DIRECTORY=/wallets/db2)(ssl_server_dn_match=yes))) ``` -------------------------------- ### Build Static Website (Bash) Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/README.md Builds the static version of the website. This process first removes the previous docs, then builds the new static content into the 'build' directory, and finally copies it to '../docs'. ```bash rm -rf ../docs npm run build cp -r build ../docs ``` -------------------------------- ### Configure Logging Settings Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/docs/getting-started/basics.md Sets up logging for the application, including the destination file path, the interval for log updates, and an option to disable logging. ```yaml log: destination: /opt/alert.log interval: 15s # disable: 0 ``` -------------------------------- ### Configure Prometheus Web Server Source: https://github.com/oracle/oracle-db-appdev-monitoring/blob/main/site/docs/getting-started/basics.md Optional configuration for the Prometheus web server, allowing customization of listen addresses, systemd socket integration, and configuration file paths. ```yaml #web: # listenAddresses: [':9161'] # systemdSocket: true|false # configFile: /path/to/webconfigfile ```