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 into float64" #1325

Closed
Mksmpm opened this issue Oct 6, 2021 · 23 comments

Comments

@Mksmpm
Copy link

Mksmpm commented Oct 6, 2021

After updating 4.1.5 to 4.2.0+ zabbix plugin, some of the graphs on the dashboards shows "No data".
In query inspector response, I can see this message in every graph that shows "No data" now :

"json: invalid use of ,string struct tag, trying to unmarshal ".5222" into float64"

image

But, interestingly, at the same time, the other part of graphs work as good as before

dbug logs:
zabbix_plugin.txt

Grafana Zabbix Grafana-Zabbix Plugin

| 8.1.5 | 5.2.1 | 4.2.4 |

@renatoborges78
Copy link

image
image
image

@alexanderzobnin alexanderzobnin added this to the 4.2.5 milestone Oct 21, 2021
@alexanderzobnin
Copy link
Collaborator

Hi! Could you please enable debug log and provide a detailed error from the log? Could you also try to disable data alignment in the query options and confirm that error persists?

@Mksmpm
Copy link
Author

Mksmpm commented Oct 21, 2021

Hello! @alexanderzobnin

Here's dbug logs attached ( also attached in initial message).
zabbix.txt

I tried "disable data alignment" in both query-options and data source options - no changes here.

@alexanderzobnin
Copy link
Collaborator

@Mksmpm is it happening in every request or only in some cases?

@renatoborges78
Copy link

renatoborges78 commented Nov 3, 2021 via email

@Mksmpm
Copy link
Author

Mksmpm commented Nov 3, 2021

@Mksmpm is it happening in every request or only in some cases?

Hello!

This happens on every request, but only for a part of the metrics. For the rest of the metrics / graphs everything works well

@alexanderzobnin
Copy link
Collaborator

Ok, got it, I will try replicate.

@alexanderzobnin
Copy link
Collaborator

Do you use direct db connection?

@Mksmpm
Copy link
Author

Mksmpm commented Nov 24, 2021

Do you use direct db connection?

No, I use API

@alexanderzobnin
Copy link
Collaborator

alexanderzobnin commented Dec 2, 2021

@Mksmpm I tried to replicate this, but without success. Looks like the only place where the bug might happen is unmarshalling history. But this only can happen if data returned from Zabbix API is wrong, like ".13" instead of "0.13". In order to make sure this is a reason, I need some data returned from API (raw JSON history). I created test build with additional logging enabled, so could you try to run it and send me logs? Build can be downloaded from the CI artifacts page https://app.circleci.com/pipelines/github/alexanderzobnin/grafana-zabbix/428/workflows/307e1dbb-9706-413a-80e1-302e6e77aebf/jobs/3010/artifacts

@renatoborges78
Copy link

@alexanderzobnin Bom dia
I saw that there was no return above, I can help in this demand!
I tried to put this plugin you made available in the download above but it's giving me an error Plugin unavailable
Can you guide me how I can apply it here in my environment? then I run the tests and send you the necessary logs to kill this bug.

image
t=2021-12-09T08:10:42-0300 lvl=eror msg="Plugin unavailable" logger=context userId=46 orgId=1 uname=2100125482 error="plugin unavailable"
t=2021-12-09T08:10:42-0300 lvl=eror msg="Request Completed" logger=context userId=46 orgId=1 uname=2100125482 method=POST path=/api/datasources/10/resources/zabbix-api status=503 remote_addr=10.191.48.116 time_ms=13 size=32 referer=https://10.128.164.176/datasources/edit/000000010

@alexanderzobnin
Copy link
Collaborator

@renatoborges78 How did you install it? Try to use grafana-cli:

grafana-cli --pluginUrl https://3010-35092819-gh.circle-artifacts.com/0/ci/packages/alexanderzobnin-zabbix-app-4.2.4.zip plugins install alexanderzobnin-zabbix-app

@renatoborges78
Copy link

@alexanderzobnin
Thanks, it worked here, I'm generating a mass of data to simulate the problem here and I'll send you all the details until tomorrow without fail.

@renatoborges78
Copy link

@alexanderzobnin
Here are the logs taken from grafana.
I noticed that the error presents when the data arrives for example the value: ".75656" or negative "- .76745"
I sent the same value that showed an error in the 2 versions that are working version 4.1.5 and version 4.2.4 that you provided me with another mass of data that also contains the problem in the current version.

error: "json: invalid use of ,string struct tag, trying to unmarshal ".6897" into float64"

Log plugin v4.2.4.txt
Log plugin v4.1.5.txt
Dados in json.txt

@alexanderzobnin
Copy link
Collaborator

@renatoborges78 Thanks! I'll take a look and try to figure it out.

@alexanderzobnin
Copy link
Collaborator

Ok, it looks really strange, like Zabbix API returns data in wrong format:

clock:"1639505501"
itemid:"1253321"
ns:"933800567"
value:"-.7692"

What Zabbix version do you use? Can you try the same dashboard with another version of Zabbix?

@renatoborges78
Copy link

I performed the tests with zabbix version 4.0.19 and zabbix 5.0.12.
I'm going to test it with version 5.4 last release so I'll answer you here

@Mksmpm
Copy link
Author

Mksmpm commented Dec 21, 2021

Hi!

I use 5.2.1 Zabbix version, but what can i do when i cannot change it? its whole other team running it, and everything works well with 4.1.5 plugin version and only after 4.2.0+ half of the panels return "error:"json: invalid use of ,string struct tag, trying to unmarshal ".1958" into float64""
As a workaround i'm using 4.1.5 \ 4.1.4 plugin verision

logs from same panel before and after downgrade attached :

zabbix_4_2_4.txt
zabbix_4_1_4.txt

@renatoborges78
Copy link

sorry I still couldn't test it in a new version because we are freezing here at the company and my approval environment is having problems with the image, so I'll get back to you with more information here.

@alexanderzobnin
Copy link
Collaborator

Could you describe your Zabbix installation? What DB do you use? Any non-standard components, like Elasticsearch for the backend?

@renatoborges78
Copy link

Alexander good night
My installation is based on an Oracle database and there is no integration with Elasticsearch on the back-end.
I'm migrating from my zabbix 4.0 to 6.0 with that I'm recreating the entire infrastructure of the same and I'll carry out the due tests of this item the test is scheduled for the 23/02th as soon as I finish the upload of the environment and I'll give you better information of this error if it really is a deficiency due to versioning.

@renatoborges78
Copy link

hello @alexanderzobnin this problem doesn't happen with the new version of Grafana 9.1.x/ Zabbix 6.2.x, this is really an isolated problem with the zabbix version 4.x.
I'm sorry for the delay in the information and tests I had a problem with a client and my attention was exclusive kkk

@alexanderzobnin
Copy link
Collaborator

Looks like it's Zabbix API bug. I'll close it since Zabbix upgrade solves it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants