Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection refused if the [client] part is not configured when setting up a multi-target configuration with [client.<name>] parts #840

Open
ArtDev45 opened this issue May 16, 2024 · 0 comments

Comments

@ArtDev45
Copy link

ArtDev45 commented May 16, 2024

Description

Hi there, I'm using this exporter in Kubernetes cluster to get MySQL/MariaDB metrics from databases. I have several databases, so in config.my-cnf file I configured several targets and named them, e.g.:

[client.host1]
host=somehost1.local
[client.host2]
host=somehost2.local
[client.host3]
host=somehost3.local

I see metrics from targets, everything working good. But, I noticed next in the logs:

ts=2024-05-05T22:16:20.639Z caller=exporter.go:152 level=error msg="Error pinging mysqld" err="dial tcp 127.0.0.1:3306: connect: connection refused"

It looks like mysqld-exporter tries to connect to the localhost MariaDB. But, I didn't specify localhost values anywhere.
My suggestion is, if I don't configure [client] part, then exporter get default values and tries to connect to the localhost.

So, the questions are: Is it possible to configure targets with name ([client.host1]) instead of [client]? Maybe have you already fixed this issue in newer versions? Or, is exporter has special argument to disable default client?

Host operating system: output of uname -a

It's docker container, the output of uname -a command:

Linux mysql-exporter-prometheus-mysql-exporter-64757ff665-ssb8m 5.14.0-362.24.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Feb 15 07:18:13 EST 2024 x86_64 GNU/Linux

mysqld_exporter version: output of mysqld_exporter --version

mysqld_exporter, version 0.15.1 (branch: HEAD, revision: cc349684494b5038ec5a52233bdca9eb9291e6f2)
  build user:       root@d89c15b9f5ad
  build date:       20231212-07:55:09
  go version:       go1.21.5
  platform:         linux/amd64
  tags:             unknown

MySQL server version

I think, that I can ignore it, because the issue was not exactly with connection, but with configuration

mysqld_exporter command line flags

/bin/mysqld_exporter --config.my-cnf=/etc/cnf/my.cnf --collect.engine_innodb_status --collect.info_schema.clientstats --collect.info_schema.innodb_cmp --collect.info_schema.innodb_cmpmem --collect.info_schema.innodb_metrics --collect.info_schema.innodb_tablespaces --collect.info_schema.processlist --collect.info_schema.query_response_time --collect.info_schema.schemastats --collect.info_schema.tablestats --collect.info_schema.userstats --no-collect.slave_status

What did you do that produced an error?

In config file, don't describe [client] part, just configure multi-target parts, e.g:

[client.some-db-1]
host=mysqlhost1
port=3306
user=someuser
password=*****
database=temp
[client.some-db-2]
host=mysqlhost2
port=3306
user=someuser
password=*****
database=temp
...

What did you expect to see?

I expect that mysqld exporter won't try to connect to the localhost mysql if I won't configure [client] part, but will configure [client.<somename>] parts

What did you see instead?

ts=2024-05-05T22:16:20.639Z caller=exporter.go:152 level=error msg="Error pinging mysqld" err="dial tcp 127.0.0.1:3306: connect: connection refused"

Additional information

As I use this module inside of Kubernetes cluster, I use this Helm chart: https://artifacthub.io/packages/helm/prometheus-community/prometheus-mysql-exporter/2.4.0
Version of Helm Chart is 2.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant