Kubernetes
The scraper needs outbound network access to Oracle and PostgreSQL. It exposes a
health endpoint on port 9161 for probes and operational checks.
The examples below assume a namespace named scraper.
Secrets
Create Oracle and PostgreSQL credentials:
kubectl create secret generic oracle-monitoring-secret \
--from-literal=username=scraperuser \
--from-literal=password='CHANGE_ME' \
-n scraper
kubectl create secret generic postgres-monitoring-secret \
--from-literal=url='postgres://oracledb_monitoring:CHANGE_ME@postgres:5432/oracledb_monitoring?sslmode=disable' \
-n scraper
Config Map
Create a scraper configuration file such as oracle-db-scraper-config.yaml:
databases:
prod:
username: ${ORACLE_USERNAME}
password: ${ORACLE_PASSWORD}
url: ${ORACLE_CONNECT_STRING}
queryTimeout: 10
connMaxLifetime: 30m
connMaxIdleTime: 5m
maxOpenConns: 10
maxIdleConns: 10
metrics:
scrapeInterval: 15s
operational:
enabled: true
interval: 1m
queryTimeout: 10s
performance:
sqlPlans:
enabled: true
interval: 2m
topN: 20
queryTimeout: 10s
output:
postgresql:
url: ${POSTGRES_URL}
autoMigrate: true
retention: 720h
log:
level: info
format: logfmt
disable: 1
web:
listenAddresses: [':9161']
Create the config map:
kubectl create cm oracle-db-scraper-config \
--from-file=oracle-db-scraper-config.yaml \
-n scraper
For user-defined additional metrics, create a config map for the definition
files, mount them into the pod, and list their paths under
metrics.definitions.
Wallets
If using an Oracle wallet, create a config map or secret from the wallet
directory and mount it into the pod. Set either TNS_ADMIN or the per-database
tnsAdmin property to the mounted path.
Deployment Shape
A deployment should provide:
CONFIG_FILE=/etc/oracledb-monitor/config.yamlORACLE_USERNAMEandORACLE_PASSWORDfrom the Oracle secretORACLE_CONNECT_STRINGas an environment variable or config valuePOSTGRES_URLfrom the PostgreSQL secret- a volume mount for the config file
- optional volume mounts for additional metric definitions or wallets
The container command should run:
/oracledb_performance_scraper --config.file=/etc/oracledb-monitor/config.yaml
Use a non-root user, a read-only root filesystem, and writable temporary/log volumes as appropriate for your cluster.
Service
Expose port 9161 only for health checks or operational access:
ports:
- name: health
port: 9161
targetPort: 9161
Health check:
kubectl port-forward svc/oracle-db-scraper 9161:9161 -n scraper
curl http://127.0.0.1:9161/healthz
Grafana
Grafana should use a PostgreSQL datasource connected to the same PostgreSQL database used by the scraper. Import or provision the dashboards from:
docker-compose/grafana/dashboards/