justwatchcom / sql_exporter

Flexible SQL Exporter for Prometheus.
MIT License
393 stars 108 forks source link

Connection properties is not working without password #67

Closed nivGandhi closed 2 years ago

nivGandhi commented 2 years ago

Hello Team,

I have configured the below connection in config map but it is not working:-

  connections:
  - 'postgres://postgres_exporter@servername/postgres?sslmode=disable'

if I pass the password properties, it is working.

  connections:
  - 'postgres://postgres_exporter:**password**@servername/postgres?sslmode=disable'  

I have configured the secret and given correct password but it is not working.

Please suggest.

is there any way to configure multiple server connection in different config map?

dewey commented 2 years ago

Are you using the placeholders to inject environment variables into the connection string? See: https://github.com/justwatchcom/sql_exporter/pull/56

nivGandhi commented 2 years ago

Are you using the placeholders to inject environment variables into the connection string? See: #56

No, I am directly passing the username and password in connections properties.

if I used placeholders variables give below error.

\"postgres://{{SNOWFLAKE_USERNAME}}:{{SNOWFLAKE_PASSWORD}}@db:5432/postgres?sslmode=disable "msg":"Failed to parse URL" invalid userinfo","job":"db","level":"error","msg":"Failed to parse URL

nivGandhi commented 2 years ago

Are you using the placeholders to inject environment variables into the connection string? See: #56

HI,

It is working now using placeholders.

Thanks for your time and reply.

dewey commented 2 years ago

Thanks for reporting back @nivGandhi! I'm unsure what caused your original error but I'm glad it's working now.