prometheus / mysqld_exporter

Exporter for MySQL server metrics
http://prometheus.io/
Apache License 2.0
2.16k stars 757 forks source link

mysql-exporter adapted for mysql v8.x version #861

Open xiaoyuan2019 opened 3 months ago

xiaoyuan2019 commented 3 months ago

Host operating system: output of uname -a

Linux ksops_test 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

mysqld_exporter version: output of mysqld_exporter --version

/ $ 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

v8.0.37

mysqld_exporter command line flags

/bin/mysqld_exporter --web.listen-address=:11010 --web.config.file=/etc/mysql_exporter_auth.yml --mysqld.address=localhost:3306 --mysqld.username=wps

What did you do that produced an error?

image

What did you expect to see?

no error

What did you see instead?

akushneruk commented 2 months ago

faced the same problem

cjabrantes commented 1 month ago

Is there any ETA for a version that supports 8.4(namely the new commands to show the status of the replicas/slaves)?

dellnoantechnp commented 1 month ago

image The new prom/mysqld-exporter image tag main is already fine.

Not have syntax to use near 'SLAVE HOSTS' log:

mysqld-exporter  | ts=2024-05-15T02:39:40.760Z caller=exporter.go:173 level=error msg="Error from scraper" scraper=slave_status target=mysql_replica:3306 err="Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SLAVE STATUS' at line 1"
mysqld-exporter  | ts=2024-05-15T02:43:26.471Z caller=exporter.go:173 level=error msg="Error from scraper" scraper=slave_hosts target=mysql_replica:3306 err="Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SLAVE HOSTS' at line 1"

image

maxant commented 1 month ago

I have something similar but a little different. I just upgraded to MySql 8.4.2 and the latest docker version (0.15.1) of the metrics exporter (version="(version=0.15.1, branch=HEAD, revision=cc349684494b5038ec5a52233bdca9eb9291e6f2)) and I get this in the logs:

ts=2024-09-29T11:15:50.739Z caller=exporter.go:173 level=error msg="Error from scraper" scraper=slave_status target=mysql:3306 err="Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SLAVE STATUS' at line 1"

maybe need to upgrade the statement to this one: https://dev.mysql.com/doc/refman/8.4/en/show-replica-status.html

kofesenko commented 1 month ago

I have something similar but a little different. I just upgraded to MySql 8.4.2 and the latest docker version (0.15.1) of the metrics exporter (version="(version=0.15.1, branch=HEAD, revision=cc349684494b5038ec5a52233bdca9eb9291e6f2)) and I get this in the logs:

ts=2024-09-29T11:15:50.739Z caller=exporter.go:173 level=error msg="Error from scraper" scraper=slave_status target=mysql:3306 err="Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SLAVE STATUS' at line 1"

maybe need to upgrade the statement to this one: https://dev.mysql.com/doc/refman/8.4/en/show-replica-status.html

@maxant 0.15.1 is older than main version of the image, and as @dellnoantechnp mentioned that image is already handling new syntax. Also, as far as I understood exported metrics were also updated to reflect these changes, so, for example _mysql_slave_status_slave_sqlrunning is equal to _mysql_slave_status_replica_sqlrunning for the mysql 8.4.*.

ascii79 commented 1 month ago

Any plan to release this on the standalone version ?

ggustafsson commented 3 weeks ago

@blkperl @SuperQ Can we get a real release with this fix?