MySQL input plugin binlog metrics do not work with MySQL 8.0.14+
Relevant telegraf.conf:
[[inputs.mysql]]
servers = ["{user}:{password}@tcp(localhost:{port})/?tls=false"]
metric_version = 2
gather_binary_logs = true
System info:
Telegraf 1.8.2 (but based on visual inspection latest code has the same issue). Fedora 28. MySQL 8.0.15.
Steps to reproduce:
- Enable MySQL input plugin and configure it to collect binary log metrics
Expected behavior:
MySQL metrics are generated.
Actual behavior:
The MySQL metrics don't work at all.
Additional info:
Logs are repeating this:
E! Error in plugin [inputs.mysql]: sql: expected 3 destination arguments in Scan, not 2
This is most likely coming from https://github.com/influxdata/telegraf/blob/master/plugins/inputs/mysql/mysql.go#L644
if err := rows.Scan(&fileName, &fileSize); err != nil {
As of 8.0.14 SHOW BINARY LOGS returns 3 columns, as shown in https://dev.mysql.com/doc/refman/8.0/en/show-binary-logs.html. The code only expects to receive 2. Should be updated to handle variadic amount of results and pick the correct ones by name to work with old and new versions. (Same applies to all uses of SHOW ..., which are currently fragile and will break if server starts returning different set of results.)
Good afternoon,
Is there any projection for this fix?
Good morning,
Is there any projection for this fix?
Good morning, Is there any projection for this fix?
@rikonen, @aimtsou, @whitedba and @zzcpower does that problem still exist with the latest version of Telegraf?
@srebhan I have not tested but looks like https://github.com/influxdata/telegraf/commit/14f428d2fdc22d967a3714b3288ef47f72dce330 at least tries to address this exact issue so I suspect this is fine now. Thanks for the ping, I'm closing this.