Comments (9)
Hi,
Thanks for your reply. My question was actually about accessing two databases from the same DBMS host. My issue was that I included the database name in the DSN like this: mysql://tcp(host1:3306)/db1. The solution is to remove the database name from the DSN then include it in the mysql query like this "select count(*) from db1.table1"
I am sure your solution will help some other users with multiple DMBSs.
from sql_exporter.
@burningalchemist, could you please answer my questions above?
from sql_exporter.
Hey @jdstone, this configuration snippet is not for Prometheus. In sql_exporter
besides a single target
scrape, we can also define jobs
: we can specify multiple targets against which the exporter executes queries.
from sql_exporter.
Hi @ambu50,
Try to apply the following snippet at sql_exporter.yml with your own adjustments:
...
jobs:
- job_name: test1
collectors: [mysql_standard]
static_configs:
- targets:
mysql1: 'mysql://tcp(host1:3306)/'
mysql2: 'mysql://tcp(host2:3306)/'
...
You need to replace target
object from the default configuration with jobs
. And collectors
becomes a part of jobs
as well, so no duplicates.
mysql1
, mysql2
are arbitrary names, can be anything.
Let me know if it works for you. I made a quick test, but didn't look deeper. 🙂
from sql_exporter.
Hey @ambu50, oh I'm sorry, I misunderstood that you meant logical databases, not database instances. Yes, this is the way. 🙂👍
from sql_exporter.
@burningalchemist, does the ability to perform a SELECT * FROM db1.table1
not work with MSSQL, as @ambu50 did with MySQL?
from sql_exporter.
Hey @jdstone, the interaction with the DB really depends on a particular driver implementation and the database. What's your current issue?
from sql_exporter.
@burningalchemist, I'd like to be able to connect to multiple databases without having to setup multiple sql_exporter containers.
I reviewed the drivers documentation, but didn't find anything that would help.
from sql_exporter.
Try to apply the following snippet at sql_exporter.yml with your own adjustments:
... jobs: - job_name: test1 collectors: [mysql_standard] static_configs: - targets: mysql1: 'mysql://tcp(host1:3306)/' mysql2: 'mysql://tcp(host2:3306)/' ...
You need to replace
target
object from the default configuration withjobs
. Andcollectors
becomes a part ofjobs
as well, so no duplicates.
mysql1
,mysql2
are arbitrary names, can be anything.Let me know if it works for you. I made a quick test, but didn't look deeper. 🙂
Hi @burningalchemist, in addition to being stuck with my previous question (from 2 days ago), I'm also confused by your response to ambu50 in the quote above. I have the following config, which specifies the Kubernetes Pod running the sql_exporter application. Are you saying that the Prometheus job configuration can be used to set to directly target a database server? Basically, I'm confused why you would want to specify a host with the mysql://
protocol (rather than http://
, or simply no protocol).
- job_name: sql-exporter
scrape_interval: 15m
static_configs:
- targets: ['10.224.0.4:30011']
Thank you.
from sql_exporter.
Related Issues (20)
- Add support for ASE database (sybase) HOT 1
- 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
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.