Skip to content
This repository has been archived by the owner on Feb 13, 2025. It is now read-only.

caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: wallet_location" #406

Open
1 of 2 tasks
DharmeshVyas-oracle opened this issue Jan 19, 2024 · 6 comments

Comments

@DharmeshVyas-oracle
Copy link

DharmeshVyas-oracle commented Jan 19, 2024

I'm submitting a ...

  • bug report
  • feature request

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

What is the expected behavior?

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Version: X.Y.Z

@DharmeshVyas-oracle DharmeshVyas-oracle changed the title Hello Team , caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: wallet_location" Jan 19, 2024
@DharmeshVyas-oracle
Copy link
Author

DharmeshVyas-oracle commented Jan 19, 2024

I am trying to scrap metric from OCI ATP database & I set the DATA_SOURCE_NAME as
export DATA_SOURCE_NAME=oracle://Username:Password@Hostname:Port/Service?ssl_server_dn_match=false&wallet_location=Wallet_Location

oracledb_exporter used is 0.5.2

[oracle@####################]$ ./oracledb_exporter --web.listen-address 0.0.0.0:9163 ts=2024-01-19T10:24:51.913Z caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: ssl_server_dn_match"
ts=2024-01-19T10:24:51.914Z caller=main.go:89 level=info msg="Starting oracledb_exporter" version="(version=, branch=, revision=b580f3fd968d56de3009b2e5454de28ebcb39da7)"
ts=2024-01-19T10:24:51.914Z caller=main.go:90 level=info msg="Build context" build="(go=go1.19.4, platform=linux/amd64, user=, date=, tags=unknown)"
ts=2024-01-19T10:24:51.914Z caller=main.go:91 level=info msg="Collect from: " metricPath=/metrics
ts=2024-01-19T10:24:51.915Z caller=tls_config.go:313 level=info msg="Listening on" address=[::]:9163
ts=2024-01-19T10:24:51.915Z caller=tls_config.go:316 level=info msg="TLS is disabled." http2=false address=[::]:9163
ts=2024-01-19T10:24:58.901Z caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: ssl_server_dn_match"
ts=2024-01-19T10:25:13.900Z caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: ssl_server_dn_match"
ts=2024-01-19T10:25:28.900Z caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: ssl_server_dn_match"

@daiguadaidai
Copy link

daiguadaidai commented Jan 20, 2024

You should refer to go-ora to use the key and value of parameters. https://github.com/sijms/go-ora

urlOptions := map[string]string {
"TRACE FILE": "trace.log",
"AUTH TYPE":  "TCPS",
"SSL": "enable",
"SSL VERIFY": "FALSE",
"WALLET": "PATH TO WALLET"
}
connStr := go_ora.BuildUrl("server", 2484, "service", "", "", urlOptions)

The example I gave above is not correct. You should execute the BuildUrl method yourself, and the string returned is the DATA_SOURCE_NAME you want.
When using ssl, the parameters should be different from the normal usage and need to be changed.

@DharmeshVyas-oracle
Copy link
Author

DharmeshVyas-oracle commented Jan 29, 2024

Thanks for reviewing & suggesting a solution.
Actually I am a Oracle database administrator & have no knowledge on go .
Below are the steps that I followed.

  1. I reviewed the page https://github.com/sijms/go-ora & I downloaded the source code .

  2. I installed go on linux using instructions in https://go.dev/doc/install. I copied the source code from step 1 to src directory of my go installation.

  3. I created a test go file with all the details , below is the file

[oracle@######## ~]$ cat go_program.go
// You can edit this code!
// Click here and start typing.
package main

import (
"fmt"
"go-ora/v2"
)

func main() {
fmt.Println("Hello")
urlOptions := map[string]string{
"TRACE FILE": "trace.log",
"AUTH TYPE": "TCPS",
"SSL": "enable",
"SSL VERIFY": "FALSE",
"WALLET": "/home/oracle/ATP_WALLET",
}
connStr := go_ora.BuildUrl("ServerName", Port, "ServiceName", "Username", "Password", urlOptions)
fmt.Println(connStr)

}

  1. I ran the go program in a hope that I get the connStr
    [oracle@######## ~]$ go run go_program.go
    go/go/src/go-ora/v2/connection.go:16:2: no required module provides package github.com/sijms/go-ora/v2/advanced_nego: go.mod file not found in current directory or any parent directory; see 'go help modules'
    go/go/src/go-ora/v2/connection.go:17:2: no required module provides package github.com/sijms/go-ora/v2/converters: go.mod file not found in current directory or any parent directory; see 'go help modules'
    go/go/src/go-ora/v2/auth_object.go:16:2: no required module provides package github.com/sijms/go-ora/v2/network: go.mod file not found in current directory or any parent directory; see 'go help modules'
    go/go/src/go-ora/v2/auth_object.go:17:2: no required module provides package github.com/sijms/go-ora/v2/network/security: go.mod file not found in current directory or any parent directory; see 'go help modules'
    go/go/src/go-ora/v2/connection_string.go:8:2: no required module provides package github.com/sijms/go-ora/v2/trace: go.mod file not found in current directory or any parent directory; see 'go help modules'
    [oracle@toolsets-app-db ~]$

@DharmeshVyas-oracle
Copy link
Author

Hello

I managed to get the go program executing & got below connecturl

oracle://user:pass@server:2484/service?TRACE FILE=trace.log&AUTH TYPE=TCPS&SSL=enable&SSL VERIFY=FALSE&WALLET=PATH+TO+WALLET

I then set this as DATA_SOURCE_NAME

export DATA_SOURCE_NAME=oracle://user:pass@server:2484/service?TRACE FILE=trace.log&AUTH TYPE=TCPS&SSL=enable&SSL VERIFY=FALSE&WALLET=PATH+TO+WALLET

[oracle@###]$ export DATA_SOURCE_NAME=oracle://Username:Password@server:Port/Service?TRACE FILE=trace.log%26AUTH TYPE=TCPS%26SSL=enable%26SSL VERIFY=FALSE%26WALLET=/home/oracle/ATP_WALLET
[oracle@###]$
[oracle@###]$ ./oracledb_exporter --web.listen-address 0.0.0.0:9163 ts=2024-01-31T05:22:07.615Z caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: TRACE"
ts=2024-01-31T05:22:07.615Z caller=main.go:89 level=info msg="Starting oracledb_exporter" version="(version=, branch=, revision=b580f3fd968d56de3009b2e5454de28ebcb39da7)"
ts=2024-01-31T05:22:07.615Z caller=main.go:90 level=info msg="Build context" build="(go=go1.19.4, platform=linux/amd64, user=, date=, tags=unknown)"
ts=2024-01-31T05:22:07.615Z caller=main.go:91 level=info msg="Collect from: " metricPath=/metrics
ts=2024-01-31T05:22:07.616Z caller=tls_config.go:313 level=info msg="Listening on" address=[::]:9163
ts=2024-01-31T05:22:07.616Z caller=tls_config.go:316 level=info msg="TLS is disabled." http2=false address=[::]:9163
ts=2024-01-31T05:22:13.900Z caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: TRACE"
^C
[oracle@###]$ export DATA_SOURCE_NAME=oracle://Username:Password@server:Port/Service?AUTH TYPE=TCPS%26SSL=enable%26SSL VERIFY=FALSE%26WALLET=/home/oracle/ATP_WALLET
[oracle@###]$ ./oracledb_exporter --web.listen-address 0.0.0.0:9163 ts=2024-01-31T05:22:38.078Z caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: AUTH"
ts=2024-01-31T05:22:38.078Z caller=main.go:89 level=info msg="Starting oracledb_exporter" version="(version=, branch=, revision=b580f3fd968d56de3009b2e5454de28ebcb39da7)"
ts=2024-01-31T05:22:38.078Z caller=main.go:90 level=info msg="Build context" build="(go=go1.19.4, platform=linux/amd64, user=, date=, tags=unknown)"
ts=2024-01-31T05:22:38.078Z caller=main.go:91 level=info msg="Collect from: " metricPath=/metrics
ts=2024-01-31T05:22:38.078Z caller=tls_config.go:313 level=info msg="Listening on" address=[::]:9163
ts=2024-01-31T05:22:38.078Z caller=tls_config.go:316 level=info msg="TLS is disabled." http2=false address=[::]:9163
ts=2024-01-31T05:22:43.900Z caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: AUTH"
^C
[oracle@###]$
[oracle@###]$

@DharmeshVyas-oracle
Copy link
Author

Hello All

I came across another exporter which is based on this exporter originally & is enhanced actively --> https://github.com/oracle/oracle-db-appdev-monitoring .
I was able to establish SSL connection to ATP OCI database using the exporter .

@gnikregrub321
Copy link

gnikregrub321 commented May 29, 2024

+1 for caller=collector.go:262 level=error errorpingingoracle:="unknown URL option: wallet_location"
oracledb_exporter-0.5.2

Since my goal was to to connect to Oracle via TCPS port this did the trick:

orapki wallet create -wallet ./CAwallet -auto_login
orapki wallet add -wallet ./CAwallet -trusted_cert -cert "Root CA.cer"
orapki wallet add -wallet ./CAwallet -trusted_cert -cert "Issuing CA.cer"

export DATA_SOURCE_NAME="oracle://user:password@myhost:2484/service?SSL=enable&WALLET=/opt/oracledb_exporter/CAwallet"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants