influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.63k stars 5.58k forks source link

Mysql plugin: missing metrics #10289

Closed martinduspiva closed 9 months ago

martinduspiva commented 2 years ago

Issue

In the package telegraf-1.20.2-1 were available following metrics: _slave_slave_sql_running slave_slave_iorunning

After upgrade on telegraf-1.21.0-1 theese metrics are missing. Did you remove these metrics, it is some bug or I need to make some changes to the plugin configuration? I didn't find mention of it in your changlelog.

Thank you.

Relevent telegraf.conf

[[inputs.mysql]]
fieldpass = ["aborted_*", "connections", "max_connections", "innodb_buffer_pool_bytes_*", "innodb_buffer_pool_pages_*", "innodb_data_*", "innodb_row*", "open_tables", "questions", "slow_queries", "slave_seconds_behind_master", "slave_slave_io_running", "slave_slave_sql_running", "threads_*", "thread_cache_size", "wsrep_local_recv_queue", "wsrep_local_send_queue", "wsrep_cert_deps_distance", "wsrep_cert_index_size", "wsrep_local_state_comment", "wsrep_cluster_size", "wsrep_cluster_status", "wsrep_local_bf_aborts", "wsrep_ready", "wsrep_connected"]
gather_slave_status = true
interval_slow = "1m"
metric_version = 2
servers = ["telegraf:XXXXXXXB@tcp(127.0.0.1:3306)/?tls=false"]
tagexclude = ["server"]

Software verison info:

$ apt-cache show "telegraf=1.20.2-1" Package: telegraf Priority: extra Section: default Installed-Size: 124764 Maintainer: support@influxdb.com Architecture: amd64 Version: 1.20.2-1 Filename: pool/main/t/telegraf/telegraf_1.20.2-1_amd64.deb Size: 34263358 MD5sum: e5b9c884e0591e79af8b7d19068c7c63 SHA1: a98ead505127eaa80dd2dcd6a05690d571dd975c SHA256: a62cc664ea9283d3623821232a36e0c5ff57c90badd7e2267ea5b48e04b3e681 SHA512: 4f3bed3963c189d1640aacfa3d297b8ff919802eb222010a2dd25ba2e68fad3928453ee3d876ee685013abc2a5fa87ae7962c06bf004b2669dd65f55398d0993 Description: Plugin-driven server agent for reporting metrics into InfluxDB. Description-md5: d2895f6fb51f407b1ee4231b2cf7a956 License: MIT Vendor: InfluxData Homepage: https://github.com/influxdata/telegraf

$ apt-cache show "telegraf=1.21.0-1" Package: telegraf Priority: extra Section: default Installed-Size: 130531 Maintainer: support@influxdb.com Architecture: amd64 Version: 1.21.0-1 Filename: pool/main/t/telegraf/telegraf_1.21.0-1_amd64.deb Size: 35766454 MD5sum: d3036b2c306a42c546f6aab1da1de457 SHA1: 88cc47a8bf06bbac0a143df03d26b3d0f9e33b5e SHA256: 4131a7dde3890c99b83d88b84e6a0f634f76aeb24517c028ab6010bf98427f4c SHA512: 8b100b975056457f896e64db70f3acde7fbdf7654b571b28eded85ee943917d7dbbb440910c0ccedb53bb7e5908e07ca7f25bdc021e6b3fce882941b84794461 Description: Plugin-driven server agent for reporting metrics into InfluxDB. Description-md5: d2895f6fb51f407b1ee4231b2cf7a956 Vendor: InfluxData Homepage: https://github.com/influxdata/telegraf License: MIT

powersj commented 2 years ago

Looks like there were two changes against mysql.go:

The second was lint fixes, but the first helped with some type conversions.

Can you run with --debug and provide some logs to see if any errors are coming out?

Thanks!

martinduspiva commented 2 years ago

With --debug is only this in the log:

2021-12-17T15:59:56Z I! Loaded inputs: conntrack cpu (2x) disk diskio exec (5x) mem mysql net netstat ntpq processes statsd system systemd_units
2021-12-17T15:59:56Z I! Loaded aggregators:
2021-12-17T15:59:56Z I! Loaded processors:
2021-12-17T15:59:56Z I! Loaded outputs: prometheus_client
2021-12-17T15:59:56Z I! Tags enabled: host=db1
2021-12-17T15:59:56Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"db1", Flush Interval:10s
2021-12-17T15:59:56Z D! [agent] Initializing plugins
2021-12-17T15:59:56Z D! [agent] Connecting outputs
2021-12-17T15:59:56Z D! [agent] Attempting connection to [outputs.prometheus_client]
2021-12-17T15:59:56Z I! [outputs.prometheus_client] Listening on http://[::]:9273/metrics
2021-12-17T15:59:56Z D! [agent] Successfully connected to outputs.prometheus_client
2021-12-17T15:59:56Z D! [agent] Starting service inputs
2021-12-17T15:59:56Z I! [inputs.statsd] UDP listening on "[::]:8125"
2021-12-17T15:59:56Z I! [inputs.statsd] Started the statsd service on ":8125"
2021-12-17T16:00:06Z D! [outputs.prometheus_client] Wrote batch of 41 metrics in 3.275232ms
2021-12-17T16:00:06Z D! [outputs.prometheus_client] Buffer fullness: 0 / 10000 metrics
2021-12-17T16:00:16Z D! [outputs.prometheus_client] Wrote batch of 49 metrics in 2.871598ms
2021-12-17T16:00:16Z D! [outputs.prometheus_client] Buffer fullness: 0 / 10000 metrics
2021-12-17T16:00:26Z D! [outputs.prometheus_client] Wrote batch of 48 metrics in 4.041205ms
2021-12-17T16:00:26Z D! [outputs.prometheus_client] Buffer fullness: 0 / 10000 metrics
powersj commented 9 months ago

Marking this as a duplicate of https://github.com/influxdata/telegraf/issues/10697

The issue here is that some fields were switched to strings, which prometheus is not going to present, as strings are tags not values. A workaround is to use the enum processor as specified in the above issue.

We can discuss changing this behavior in #10697 as well.