albertodonato / query-exporter

Export Prometheus metrics from SQL queries
GNU General Public License v3.0
436 stars 101 forks source link

Unable to Connect query exporter to Azure SQL database using System Account #146

Open vaishnavi216 opened 1 year ago

vaishnavi216 commented 1 year ago

Describe the bug Unable to connect Azure SQL database from query exporter using System account credentials.

query exporter config database details: db1: dsn: mssql+pyodbc://<>:<>@<>:1433/<>?driver=ODBC+Driver+17+for+SQL+Server&Trusted_connection=yes autocommit: false keep-connected: true labels: app: sqldb

Post deployment we are unable to get SQL server metrics , below errors observed from pod logs

2023-04-18 05:24:40,986 - ERROR - query-exporter - error from database "db1": (pyodbc.Error) ('HY000', '[HY000] [Microsoft][ODBC Driver 17 for SQL Server]SSPI Provider: No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000) (851968) (SQLDriverConnect)')

without "Trusted_connection=yes" in the above mentioned dsn facing below error

2023-04-17 14:29:16,765 - ERROR - query-exporter - error from database "db1": (pyodbc.InterfaceError) ('28000', "[28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user '***'. (18456) (SQLDriverConnect)") (Background on this error at: http://sqlalche.me/e/13/rvf5)

Connection Details:

How to resolve this error or any other way to connect query exporter to Azure SQL database using System account?