首页 > 解决方案 > HO 修复“json:无法将字符串解组到 Go struct 字段 Event.No. uint64 类型的排队事件”

问题描述

我正在尝试在我的本地环境中实现“maxscale_exporter”。但是我没有在 Prometheus 中获得与 maxscale 相关的所有状态,我也遇到了一些重复性错误,如下所示。

json: cannot unmarshal string into Go struct field Status.Value of type float64
json: cannot unmarshal string into Go struct field Event.No. Events Queued of type uint64
json: cannot unmarshal string into Go struct field Server.Port of type int
json: cannot unmarshal string into Go struct field Service.No. Sessions of type float64
json: cannot unmarshal string into Go struct field Status.Value of type float64
json: cannot unmarshal string into Go struct field Event.No. Events Queued of type uint64
json: cannot unmarshal string into Go struct field Server.Port of type int
json: cannot unmarshal string into Go struct field Service.No. Sessions of type float64

我不知道“go lang”是如何工作的,但这似乎是选角问题。

我已经安装了运行正常的 Prometheus。我正在使用 PMM 工具包进入 galera 集群的站点(工作正常)[带有 mysql_exporter 和 linux] 部分。

我已按照下面提到的说明进行操作

https://github.com/mariadb-corporation/maxscale_exporter

我无法集成这个 maxscale 导出器(我假设它应该像 Prometheus 中的其他部分一样工作)并在 grafana 中显示正常。

“maxscale_exporter”也应该像“mysqld_exporter”一样工作正常

我只从 go 文件中提到的一堆变量和 repo 中提到的预期输出中从 maxscale 中得到 4 个变量。

标签: grafanaprometheusexportermaxscale

解决方案


如果您使用的是较新的 MaxScale 版本,则某些值已被删除,因为它们已因 MaxScale 的改进而过时。为导出器编写的 MaxScale 版本可能具有不同的输出。

我建议删除任何导致这些错误的代码,看看是否可以修复它。


推荐阅读