Comments (22)
@reubano it's released, please have a look. I expect things to work now. :))
from sql_exporter.
For anyone else finding this post after searching context deadline exceeded
, that error can also mean that the query timed out. To fix it, I increased the scrape_timeout
parameter for both prometheus
and sql_exporter
so that they are longer than the expected query time.
from sql_exporter.
Hi @reubano, thanks for the suggestion. We would need to provide a pull request to the upstream to include azuresql
schema to xo/dburl
to recognise the DSN. This seems to be a small change, so the draft PR is created already.
After it's merged, you will need add/replace the package by the subpackage azuread
as in the example in your link and rebuild the package.
It'd be great to test it before adding this subpackage by default.
I'll keep you posted.
Kind regards,
Sergei
UPD: pointed at the wrong line initially.
from sql_exporter.
Getting errors. Not sure of the root cause, but I filed an issue at xo/usql#380.
from sql_exporter.
@jdstone Yes, the issue is resolved. However I remember @reubano had an issue with a system-assigned identity. Currently I assume it's either on the Azure side configuration or the driver itself.
@reubano we're happy to help, I guess. :) 👍
from sql_exporter.
I think I got it. Took a while to obtain the proper Azure authorization. I'm using v0.11.1 now with the azuresql
protocol. Restarted the systemd
service and no errors so far.
from sql_exporter.
The issue was fixed in xo/dburl here.
from sql_exporter.
Hey @reubano, I followed the thread, I'll release an update shortly. 👍
from sql_exporter.
It's good to go now! Thanks again!!
from sql_exporter.
Reference: xo/dburl#21
from sql_exporter.
Hi @reubano, the aforementioned PR is merged. I've also updated the version of dburl on our side. So, to test whether it works, you need to do the following:
- clone the current master
- update the package as per link above (simply add
/azuread
) - run
make build
to produce the binary - try it out with your configuration file
Please let me know if you need any assistance. Unfortunately, I don't have access to any Azure infrastructure now to try it out myself.
from sql_exporter.
Thanks! I'm waiting to get access to a component in my app before I can test this. I'll keep you posted!
from sql_exporter.
Hey @reubano, it seems like the issue was fixed at the end of the year (just checked). sql_exporter v0.9.2
is also using the latest dburl v0.13
dependency. Please have a look. 👍
from sql_exporter.
@burningalchemist, it looks like this issue is resolved by the recent code change you just made (and described in #187), right?
(I wanted to note this if that was actually the case here. Feel free to delete my comment if this is inaccurate.)
from sql_exporter.
Glad to hear the issue is resolved! :)
from sql_exporter.
Guess I spoke too soon. curl http://localhost:9399/metrics
outputs the following:
No metrics gathered, [from Gatherer #1] unable to open tcp connection with host 'localhost:1433': dial tcp 127.0.0.1:1433: connect: connection refused
I'm not sure why its trying to connect on localhost.
systemctl status sql-exporter
● sql-exporter.service - SQL Exporter
Loaded: loaded (/etc/systemd/system/sql-exporter.service; indirect; vendor preset: enabled)
Active: active (running) since Tue 2023-08-15 19:46:27 UTC; 25s ago
Main PID: 21235 (sql_exporter)
Tasks: 4 (limit: 4069)
CGroup: /system.slice/sql-exporter.service
└─21235 /usr/bin/sql_exporter -log.level debug -config.file sql_exporter.yml
Aug 15 19:48:15 xxx sql_exporter[21582]: ts=2023-08-15T19:48:15.680Z caller=klog.go:84 level=debug func=Infof msg="Loaded collector 'worklist_counts' from /home/azureuser/prometheus/files/worklist_counts.collector.yml"
Aug 15 19:48:15 xxx sql_exporter[21582]: ts=2023-08-15T19:48:15.682Z caller=klog.go:84 level=debug func=Infof msg="Loaded collector 'worklist_metrics' from /home/azureuser/prometheus/files/worklist_metrics.collector.yml"
Aug 15 19:48:15 xxx sql_exporter[21582]: ts=2023-08-15T19:48:15.682Z caller=klog.go:55 level=debug func=Verbose.Infof msg="[collector=\"worklist_counts\"] Non-zero min_interval (10m), using cached collector."
Aug 15 19:48:15 xxx sql_exporter[21582]: ts=2023-08-15T19:48:15.685Z caller=klog.go:55 level=debug func=Verbose.Infof msg="[collector=\"worklist_metrics\"] Non-zero min_interval (10m), using cached collector."
Aug 15 19:48:15 xxx sql_exporter[21582]: ts=2023-08-15T19:48:15.685Z caller=klog.go:96 level=warn func=Warning msg="Listening on :9399"
Aug 15 19:48:15 xxx sql_exporter[21582]: ts=2023-08-15T19:48:15.692Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9399
Aug 15 19:48:15 xxx sql_exporter[21582]: ts=2023-08-15T19:48:15.692Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9399
Aug 15 19:48:25 xxx sql_exporter[21582]: ts=2023-08-15T19:48:25.460Z caller=klog.go:84 level=debug func=Infof msg="Database handle successfully opened with 'sqlserver' driver"
Aug 15 19:48:25 xxx sql_exporter[21582]: ts=2023-08-15T19:48:25.460Z caller=klog.go:84 level=debug func=Infof msg="Error gathering metrics: [from Gatherer #1] unable to open tcp connection with host 'localhost:1433': dial tcp 127.0.0.1:1433: connect: connection refused"
Aug 15 19:49:25 xxx sql_exporter[21582]: ts=2023-08-15T19:49:25.460Z caller=klog.go:84 level=debug func=Infof msg="Error gathering metrics: [from Gatherer #1] unable to open tcp connection with host 'localhost:1433': dial tcp 127.0.0.1:1433: connect: connection refused"
sql_exporter.yml
# Global settings and defaults.
global:
# Subtracted from Prometheus' scrape_timeout to give us some headroom and prevent Prometheus from
# timing out first.
scrape_timeout_offset: 500ms
# Minimum interval between collector runs: by default (0s) collectors are executed on every scrape.
min_interval: 600s
# Maximum number of open connections to any one target. Metric queries will run concurrently on
# multiple connections.
max_connections: 3
# Maximum number of idle connections to any one target.
max_idle_connections: 3
# The target to monitor and the list of collectors to execute on it.
target:
# Data source name always has a URI schema that matches the driver name. In some cases (e.g. MySQL)
# the schema gets dropped or replaced to match the driver expected DSN format.
data_source_name: 'azuresql://XXX.database.windows.net?database=XXX&fedauth=ActiveDirectoryManagedIdentity'
# Collectors (referenced by name) to execute on the target.
collectors: [worklist_*]
collector_files:
- "*.collector.yml"
It's at least logging in because if I remove fedauth=ActiveDirectoryManagedIdentity
it errors with No metrics gathered, [from Gatherer #1] mssql: login error: Login failed for user ''.
from sql_exporter.
Hmmm, seems to be a downstream issue. I see the same error with [email protected] while [email protected] works fine.
from sql_exporter.
Still no luck :(
$ curl http://localhost:9399/metrics
No metrics gathered, [from Gatherer #1] mssql: login error: Login failed for user ''.
$ sql_exporter --version
sql_exporter, version 0.12.0 (branch: HEAD, revision: e934efa67f5702a96f6b6a1632b7e78fc678d66b)
build user: root@1e5240ff6c6d
build date: 20230817-16:40:52
go version: go1.20.7
platform: linux/amd64
tags: netgo
$ systemctl status sql-exporter
● sql-exporter.service - SQL Exporter
Loaded: loaded (/etc/systemd/system/sql-exporter.service; indirect; vendor preset: enabled)
Active: active (running) since Mon 2023-08-21 19:46:27 UTC; 25s ago
Main PID: 21235 (sql_exporter)
Tasks: 4 (limit: 4069)
CGroup: /system.slice/sql-exporter.service
└─21235 /usr/bin/sql_exporter -log.level debug -config.file sql_exporter.yml
Aug 20 19:48:15 xxx sql_exporter[21582]: ts=2023-08-20T19:48:15.680Z caller=klog.go:84 level=debug func=Infof msg="Loaded collector 'worklist_counts' from /home/azureuser/prometheus/files/worklist_counts.collector.yml"
Aug 20 19:48:15 xxx sql_exporter[21582]: ts=2023-08-20T19:48:15.682Z caller=klog.go:84 level=debug func=Infof msg="Loaded collector 'worklist_metrics' from /home/azureuser/prometheus/files/worklist_metrics.collector.yml"
Aug 20 19:48:15 xxx sql_exporter[21582]: ts=2023-08-20T19:48:15.682Z caller=klog.go:55 level=debug func=Verbose.Infof msg="[collector=\"worklist_counts\"] Non-zero min_interval (10m), using cached collector."
Aug 20 19:48:15 xxx sql_exporter[21582]: ts=2023-08-20T19:48:15.685Z caller=klog.go:55 level=debug func=Verbose.Infof msg="[collector=\"worklist_metrics\"] Non-zero min_interval (10m), using cached collector."
Aug 20 19:48:15 xxx sql_exporter[21582]: ts=2023-08-20T19:48:15.685Z caller=klog.go:96 level=warn func=Warning msg="Listening on :9399"
Aug 20 19:48:15 xxx sql_exporter[21582]: ts=2023-08-20T19:48:15.692Z caller=tls_config.go:232 level=info msg="Listening on" address=[::]:9399
Aug 20 19:48:15 xxx sql_exporter[21582]: ts=2023-08-20T19:48:15.692Z caller=tls_config.go:235 level=info msg="TLS is disabled." http2=false address=[::]:9399
Aug 20 19:48:25 xxx sql_exporter[21582]: ts=2023-08-20T19:48:25.460Z caller=klog.go:84 level=debug func=Infof msg="Database handle successfully opened with 'sqlserver' driver"
Aug 20 19:48:25 xxx sql_exporter[21582]: ts=2023-08-20T19:48:25.460Z caller=klog.go:84 level=debug func=Infof msg="Error gathering metrics: [from Gatherer #1] mssql: login error: Login failed for user ''."
Aug 20 19:49:25 xxx sql_exporter[21582]: ts=2023-08-20T19:49:25.460Z caller=klog.go:84 level=debug func=Infof msg="Error gathering metrics: [from Gatherer #1] mssql: login error: Login failed for user ''."
usql
works though (which also uses dburl v0.16.0
)
$ go install -tags sqlserver github.com/xo/[email protected]
go: downloading github.com/xo/usql v0.15.0
$ usql 'azuresql://xxx.database.windows.net?database=xxx&fedauth=ActiveDirectoryMSI'
Connected with driver sqlserver (Microsoft SQL Server x.x, RTM, SQL Azure)
Type "help" for help.
ms:xxx=>
The last sql_exporter
version I got to work was 0.9.3
.
from sql_exporter.
It actually seems like 0.9.3
suffers from #179 since I'm seeing lots of prepare query failed: context deadline exceeded
in the logs.
from sql_exporter.
Let me know if there's anything I can do to help out. I'm not a go coder, but I can try to get by.
from sql_exporter.
Hey @reubano, It's a common error (context deadline exceeded
) in case when the connection can't be established.
I see the error on your end in the logs: mssql: login error: Login failed for user ''
. Might it be related to some authentication issue or you can still successfully login with the old version?
from sql_exporter.
I guess I see the reason:
Database handle successfully opened with 'sqlserver' driver"
, whereas we expect azuresql
to be the right scheme to use AAD. I'll check that part and release a patch.
from sql_exporter.
Related Issues (20)
- Context deadline exceeded error handling HOT 4
- The problem of specifying a schema when capturing PostgreSQL metrics HOT 6
- Different collector file for each differrent job HOT 1
- Allow to set metric timestamp from query results
- Caching context deadline exceeded result HOT 6
- Context Deadline Exceeded HOT 9
- Support for MSSQL named pipe (np:) and shared memory (lpc:) DSNs HOT 16
- `up` metric to show that database connection was successful HOT 5
- parameter to set log file location HOT 8
- Add custom metrics to expose MSSQL server hostname HOT 1
- can we have the Postgres collector yml file example
- Is it possible to distinguish between the sql exporter process status and the target database? HOT 3
- Scrape each job separately HOT 2
- [helm] Support getting data-source-name from an existing secret HOT 12
- Ignore no rows returned HOT 6
- Better handling of NULL return values in certain cases HOT 6
- Environment variable substitution for DSN's HOT 3
- Cache Mechanism for sql exporter HOT 2
- clickhouse `context deadline exceeded` HOT 1
- Helm chart improvement: additionalContainers HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sql_exporter.