Open Kiara0107 opened 1 year ago
This should be fixed in 2.9.0, which is also current latest
docker image
Unfortunately not. To be sure I removed the docker image and pulled the latest image from the repository.
~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
adonato/query-exporter latest 98ec5e988c9c 2 days ago 515MB
Still the same error.
~$ docker logs query-exporter
2023-08-21 07:32:33,727 - ERROR - query-exporter - error from database "database_01": (pyodbc.Error) ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
Can you try using the dictionary format for the dsn
, just to make sure it's not an issue with passing driver options?
What do you mean by 'dictionary format' for the dsn?
dsn:
dialect: <dialect>[+driver]
user: <username>
password: <password>
host: <host>
port: <port>
database: <database>
options:
<key1>: <value1>
<key2>: <value2>
as shown in the readme
Ah, yes, tried that as well. Unfortunately the same result:
2023-08-23 13:07:14,425 - ERROR - query-exporter - error from database "database_01": (pyodbc.Error) ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
(Background on this error at: http://sqlalche.me/e/13/dbapi)
In query.yml
databases:
database_01:
dsn:
dialect: mssql+pyodbc
user: {{user}}
password: {{password}}
host: {{host}}
port: 1433
database: database_01
options:
driver: 'ODBC Driver 17 for SQL Server'
MARS_Connection: yes
keep-connected: false
autocommit: false
@albertodonato any updates or suggestions on this matter?
I found a sort of work-around. When I update line 49 to ACCEPT_EULA=Y apt-get install -y --no-install-recommends msodbcsql17 && \
it works. And then ofcourse build locally a new image
Would you mind proposing a PR with the change?
@albertodonato Hi, I have an local branch ready for this fix (as written above), Can you add me permissions to submit my branch?
What do you mean? You don't need permissions to make a PR with your changes
With the current 2.9.2 image you have to change the URL to use ODBC driver 18 and ignore the self signed SSL certificate.
from: mssql+pyodbc://user:password@host_ip:port/database?driver=ODBC+Driver+17+for+SQL+Server&MARS_Connection=Yes
to: mssql+pyodbc://user:password@host_ip:port/database?TrustServerCertificate=yes&driver=ODBC+Driver+18+for+SQL+Server&MARS_Connection=Yes
Describe the bug Error when trying to connect the database, log shows:
Installation details
query-exporter installation type:
pip list
]snap info query-exporter
]Each query can be run on multiple databases, and update multiple metrics.
The snap provides both the
query-exporter
command and a deamon instance of the command, managed via a Systemd service. To run the latter:/var/snap/query-exporter/current/config.yaml
with the configurationsudo snap restart query-exporter
Currently supported databases are:
postgresql://
)mysql://
)sqlite://
)mssql://
)db2://
) on supported architectures (x86_64, ppc64le and s390x) snap-id: ssukadvQVTCbvJ0h7QH6ouseq7X9vbib channels: latest/stable: 2.8.1 2022-02-18 (836) 43MB - latest/candidate: ↑ latest/beta: ↑ latest/edge: 2.8.3+git2.4f9442b 2023-04-12 (882) 47MB -To Reproduce
If possible, please provide detailed steps to reproduce the behavior:
Config file content (redacted of secrets if needed)
Ran query-exporter with the following command line ...
Got the error when ... As soon as the first connection attempt is made.
Query exporter metrics: