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

Error "json: invalid use of ,string struct tag, trying to unmarshal unquoted value into int64" #1386

Closed
Ethan0451 opened this issue Feb 8, 2022 · 6 comments

Comments

@Ethan0451
Copy link

Ethan0451 commented Feb 8, 2022

Grafana Zabbix Grafana-Zabbix Plugin
8.3.1 5.4.9 4.2.4

A few days ago , I updated the zabbix from 5.2.2 to 5.4.9
At the same time , I reinstall the grafana and grafana-zabbix plugin , but when I create the panel , I got this error
By the way , my zabbix use Elasticsearch to store history data

Thanks for helping

grafana.log
request_details.txt

@nikossss
Copy link

solved the problem? please help me

@Ethan0451
Copy link
Author

Ethan0451 commented Jul 14, 2022

solved the problem? please help me

我不确定你是否遇到与我一样的问题。我的问题原因是使用es作为数据存储时,zabbix api返回的数据没有引号,而作者的代码中,需要数据类型为字符类型,而不是数字,所以我在本地修改了几行代码并重新编译后,可以使用

I'm not sure if you have the same problem as me. The reason for my problem is that when ES is used as history data storage, the data returned by ZABBIX API has no quote, and the data type in the author's code needs to be string type, so I modified a few lines of code locally and recompiled it, and it can be used

diff grafana-zabbix-4.2.8/pkg/datasource/response_handler.go grafana-zabbix-4.2.8.my/pkg/datasource/response_handler.go
24,26c24,26
< 		pointItem := itemsMap[point.ItemID]
< 		if seriesMap[point.ItemID] == nil {
< 			seriesMap[point.ItemID] = timeseries.NewTimeSeriesData()
---
> 		pointItem := itemsMap[strconv.FormatInt(point.ItemID,10)]
> 		if seriesMap[strconv.FormatInt(point.ItemID,10)] == nil {
> 			seriesMap[strconv.FormatInt(point.ItemID,10)] = timeseries.NewTimeSeriesData()
28c28
< 		pointSeries := seriesMap[point.ItemID]
---
> 		pointSeries := seriesMap[strconv.FormatInt(point.ItemID,10)]

diff grafana-zabbix-4.2.8/pkg/zabbix/models.go grafana-zabbix-4.2.8.my/pkg/zabbix/models.go
70,71c70,71
< 	ItemID   string `json:"itemid,omitempty"`
< 	Clock    int64  `json:"clock,omitempty,string"`
---
> 	ItemID   int64 `json:"itemid,omitempty"`
> 	Clock    int64  `json:"clock,omitempty"`
81,82c81,82
< 	ItemID string  `json:"itemid,omitempty"`
< 	Clock  int64   `json:"clock,omitempty,string"`
---
> 	ItemID int64  `json:"itemid,omitempty"`
> 	Clock  int64   `json:"clock,omitempty"`
84c84
< 	NS     int64   `json:"ns,omitempty,string"`
---
> 	NS     int64   `json:"ns,omitempty"`

@nikossss
Copy link

yes, i m use elastic. thank you, i replace a few line, how to compiled?

@nikossss
Copy link

please tell me how to compiled?

@Ethan0451
Copy link
Author

@nikossss
Copy link

don,t work(

Entrypoint undefined = extract-text-webpack-plugin-output-filename
[../node_modules/css-loader/dist/cjs.js!../node_modules/sass-loader/dist/cjs.js!./sass/grafana-zabbix.dark.scss] 41.1 KiB {0} [built]
    + 2 hidden modules

Child extract-text-webpack-plugin ../node_modules/extract-text-webpack-plugin/dist ../node_modules/css-loader/dist/cjs.js!../node_modules/sass-loader/dist/cjs.js!sass/grafana-zabbix.light.scss:
Entrypoint undefined = extract-text-webpack-plugin-output-filename
[../node_modules/css-loader/dist/cjs.js!../node_modules/sass-loader/dist/cjs.js!./sass/grafana-zabbix.light.scss] 41.1 KiB {0} [built]
+ 2 hidden modules
Infinitely performs
problem signed plugin

could you build for me 4.2.9 ver ?

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

2 participants