Comments (9)
@burningalchemist thank you! I check this out in the morning and revert. Also both exporter and MS SQL are running on the same node. In fact, my grafana which is running on a different node (all nodes are within the same network, so they can ping each other at least) is a able to connect to the MS SQL instance via Grafana plugin.
For the password encoding, I will try that once I am back in the datacenter in the morning and revert. Thank you!
from sql_exporter.
@burningalchemist MSSQLINSTANCE is not database name. It's an instance name, meaning there are at least 1 database in it. I got the connection string idea from https://github.com/microsoft/go-mssqldb#connection-parameters-and-dsn and also https://github.com/free/sql_exporter/#data-source-names when I first tried to use free/sql_exporter.
Yea I agree with you. This is an authentication issue with the DB itself. I just setup the same configuration on my local workstation and I don't have this issue at all. In fact, I didn't have to encode special characters and everything just check out. I am engaging the database team to help me figure out the issue with the DB user. I do not have control over the DB server.
Thanks for usql too. Found it useful. Sorry I am not a database engineer, just user of database.
Thanks
from sql_exporter.
@burningalchemist You are right all along! Error was due to permissions given to SQL server user. Took a couple of hours to read about MS SQL installation, Studio manager, creating instances and adding databases and playing around with permissions over instances and individual databases. Then went to database engineers telling them exactly what needs to be done. All I needed was View any database
permission. Damn it! Spend days working with people who are not knowledgeable enough about the service they own.
Thank you! This can be closed
from sql_exporter.
Hey @barywhyte thanks for following up on this. I'm glad you got it working. 👍🚀
from sql_exporter.
So, as I previously replied with:
Context deadline exceeded, especially in your case, implies that the exporter can't
successfully connect to the database. You need to check if the node is accessible from
the network you're running the exporter on.
0.12.2-3 improved the error propagation.
I would start with that. It looks to me either as an authentication issue or a networking issue.
Also, please note:
If your DSN contains special characters in any part of your connection string (including passwords), you might need to apply URL encoding (percent-encoding) to them.
For example, p@$$w0rd#abc
then becomes p%40%24%24w0rd%23abc
.
from sql_exporter.
@barywhyte if networking is not an issue, I bet it's the authentication details (url encoded stuff). Give it a check. 👍
from sql_exporter.
@burningalchemist Thank you. And yes this is not networking issue. Two servers can ping each other and I am able to access wmi exporter via my prometheus server as seen in the diagram here.
However, after encoding special characters, I still encountered the same context deadline exceeded
error. Here is my connection string:
sqlserver://prom_ur:%23%21%[email protected]:1433/MSSQLINSTANCE'
. With or without MSSQLINSTANCE, the same error persist. On my remote prometheus server, server returned **
HTTP status 500 Internal Server Error**
error showed up which speaks to **
context deadline exceeded**
error on the DB side
from sql_exporter.
Hi @barywhyte,
As I mentioned before, context deadline exceeded
is a generic error, which implies that the result cannot be returned in assigned amount of time (10s by default). This can be anything - authentication details, authentication query parameters, an incorrect or incomplete connection string.
Also, DSN has a strict format, so it should be correct. Please check the spec here: https://github.com/xo/dburl?tab=readme-ov-file#example-urls. To me, MSSQLINSTANCE
string seems incorrect as I don't think it's the database name, is it?
Also, your query might be expensive enough, so the timeout happens, you might need to increase the timeout significantly.
I'd suggest you to pick usql
tool, and try to connect with it first, this might help, if none of the above does. sql_exporter
is based upon the same library, so it should help identify the correct parameters to connect properly.
from sql_exporter.
@barywhyte No worries at all, hope the issue gets solved for you soon. usql
is a decent tool to prove things work correct. Once you confirmed the connection is stable and you can execute queries, the rest should work as well. 👍
With the connection string itself, it's a little bit tricky, since sql_exporter
goal is to support as many databases as possible, we use dburl
dependency, which format at times might be different from particular drivers. It's consistent among all the supported drivers, though.
from sql_exporter.
Related Issues (20)
- `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
- Can it support the collection of cloud databases HOT 1
- unable to use -web.listen.address flag HOT 4
- SIGHUP config reload HOT 4
- Clickhouse requests dosn't work after upgrade clickhouse driver to v2 HOT 6
- Scrape errors not clearing without restart HOT 3
- Config interpolation (secrets) HOT 6
- Can't use UNIX socket for postgres connection 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.