mysqld_exporter
mysqld_exporter copied to clipboard
Support for scraping multiple mysqld hosts.
Discussion at https://github.com/prometheus/mysqld_exporter/issues/452#issuecomment-701893399
Short summary:
This adds a new flag called export-multi-hosts and allows for passing a yaml file which contains the config related to this mode. Note that this change does not make any changes to the way mysqld_exporter works and as a result it would continue to use the ini format config when working in the non export-multi-hosts mode.
My only question is, because mysql users are used to the INI style of my.cnf, maybe we should stick to INI parsing. I would prefer to implement one kind of config for the exporter. Having multiple ways to configure gets confusing for users.
I also think port should come from the target URL param, not the config.
I'm thinking a config something along the lines of:
clients:
default:
user: foo
password: foo123
other_server:
user: bar
password: bar123
Or in INI style
[client]
user = foo
password = foo123
[client.other_server]
user = bar
password = bar123
Makes sense. Given that the currently supported format is INI, I will try to modify my change to use INI instead of yaml.
It looks like some of the commits are missing DCO.
YAML would have the advantage of being well-established in Prometheus-land; the question is if users are more likely to be DBAs exposing data or Prometheus people grabbing data from a lot of different places. I would suspect the latter, but don't have data, of course.
@RichiH Supporting the MySQL-style INI file was an often, and now implemented, requested feature. I think we want to stick with it.
Here's a proposal on how the final config (one config to rule them all) would look like.
[client]
user = foo
password = foo123
target = hostname:3306
[client.module1]
user = bar
password = bar123
The target key is only allowed in the default case and is ignored/rejected by additional modules.
/metricsURL would be a backwards equivalent of/mysql?module=default./mysql?module=default&target=some-remote:3306would use the default user/password but override the target./mysql?module=module1is invalid, as it doesn't contain a target./mysql?module=module1&target=some-remote:3306is a typical scrape of a remote.
I'm also thinking about an option to make /metrics not return mysql data, just exporter data. This would make it easier to separate exporter data from target data. Easier to monitor the health of just the exporter.
Any progress on this? Would be very nice to have this.
When is this being merged? We are waiting for this too.
Hi, When this will get merge, we are also waiting for this.
For our internal use case my implementation is sufficient. I won't be able to work on the proposal as outlined at #504 (comment). If any one else wants to take this forward, please feel free to go ahead.
Alright, if I can find some help to work on this, we could merge it and build on it. But as-is, this needs work before it could be released.
Is it possible to use prometheus exporter when mysql is running on a different port then 3306? When i change the /etc/.mysqld_exporter.cnf file for looking at another port. it still tries to connect with port 3306. changes i have made are.
[client] user=mysqld_exporter password=apassword host=localhost:portnumber
exporter service is running with error level=error msg="Error pinging mysqld: dial tcp: lookup localhost:45654:3306:
I have an improved version here, transformed into a probe, which supports http incoming parameters like blackbox_exporter . https://github.com/ning1875/mysqld_exporter/releases/tag/v0.12.1
Is there a plan to finalize this PR?
This was completed in #651