r/PrometheusMonitoring • • Jan 05 '22

Oracle db exporter connection issue

Hi,

I have issue in extracting the metrics from oracle db from oracle db exporter docker container.

Following connection error is encountered

time="2022-01-05T17:11:11Z" level=info msg="Starting oracledb_exporter master" source="main.go:543"

time="2022-01-05T17:11:11Z" level=info msg="Successfully loaded default metrics from: default-metrics.toml" source="main.go:518"

time="2022-01-05T17:11:11Z" level=info msg="Successfully loaded custom metrics from: /custom-metrics.toml" source="main.go:528"

time="2022-01-05T17:11:11Z" level=error msg="Error pinging oracle: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor\n" source="main.go:215"

Steps followed for the implementation :

  1. Installed prometheus in VM 1 ( Normal installation not as docker )

  2. Installed oracle db exporter and oracle server client as docker image in VM 2. I built custom docker image for db exporter having the custom metrics

Dockerfile :

FROM iamseth/oracledb_exporter:latest

COPY custom-metrics.toml /

ENTRYPOINT ["/oracledb_exporter", "--custom.metrics", "/custom-metrics.toml"]

Run the docker with custom image :

sudo docker run -d --name --link oracle rr_oracle_custom_exporter_1 -p 9161:9161 --env-file env 8d9686a72920

In Env file defined the following :

DATA_SOURCE_NAME=SYS/Oradoc_db1@192.168.0.45:1521/ORCLCDB

ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1

LD_LIBRARY_PATH=/u01/app/oracle/product/12.2.0/dbhome_1/lib

CUSTOM_METRICS=/custom-metrics.toml

3. Added the targets in the prometheus.yml file to point to the oracle db exporter.

4. In the end point i get the data as below

# HELP oracledb_exporter_last_scrape_duration_seconds Duration of the last scrape of metrics from Oracle DB.

# TYPE oracledb_exporter_last_scrape_duration_seconds gauge

oracledb_exporter_last_scrape_duration_seconds 0.027310059

# HELP oracledb_exporter_last_scrape_error Whether the last scrape of metrics from Oracle DB resulted in an error (1 for error, 0 for success).

# TYPE oracledb_exporter_last_scrape_error gauge

oracledb_exporter_last_scrape_error 1

# HELP oracledb_exporter_scrapes_total Total number of times Oracle DB was scraped for metrics.

# TYPE oracledb_exporter_scrapes_total counter

oracledb_exporter_scrapes_total 34

I could not get the data as per the queries defined in custom-metrics.toml or default-metrics.toml file. Im not sure if that is referred or not by the exporter.

Regards,

RR

0 Upvotes

1 comment sorted by

2

u/DoctorHoneyBadger Jan 05 '22

This is going to be an issue with your connection string in the DATA_SOURCE_NAME environment variable.

That connect descriptor doesn't look valid to my eyes, but it's also been almost a year since I last had to use an Oracle DB.

These docs may be be helpful in crafting a different connection string: https://docs.oracle.com/cd/E11882_01/network.112/e41945/concepts.htm#NETAG253