grafana-zabbix icon indicating copy to clipboard operation
grafana-zabbix copied to clipboard

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

Open Mksmpm opened this issue 4 years ago • 22 comments

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 |

Mksmpm avatar Oct 06 '21 14:10 Mksmpm

image image image

renatoborges78 avatar Oct 14 '21 19:10 renatoborges78

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?

alexanderzobnin avatar Oct 21 '21 07:10 alexanderzobnin

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.

Mksmpm avatar Oct 21 '21 09:10 Mksmpm

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

alexanderzobnin avatar Nov 02 '21 08:11 alexanderzobnin

Hello, in my case it happens in all requests regardless of the data filter, the problem is in the return value. I'm using Grafana's Stat plugin with dadasource Zabbix plugin: version: 4.2.4

Mine is giving an error in the sample data below: 03-11-2021 08:50:28 -5.53 03-11-2021 08:49:29 -4.5872 03-11-2021 08:48:29 -0.4695 03-11-2021 08:47:28 -3.7037 03-11-2021 08:46:29 2.8846

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

De: Alexander Zobnin @.*** Enviada em: terça-feira, 2 de novembro de 2021 05:39 Para: alexanderzobnin/grafana-zabbix @.> Cc: RENATO CUSTODIO BORGES @.>; Comment @.***> Assunto: Re: [alexanderzobnin/grafana-zabbix] Error "json: invalid use of ,string struct tag, trying to unmarshal into float64" (#1325)

CUIDADO E-MAIL EXTERNO: Não clique em links ou abra anexos, a menos que reconheça o remetente e saiba que o conteúdo é seguro.

@Mksmpmhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMksmpm&data=04%7C01%7Crenato.borges%40via.com.br%7C9c4a0c43a3f74dd44e3f08d99ddc40cb%7C5a86b3fb421349cdb4d6be91482ad3c0%7C0%7C0%7C637714391607467910%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=efGIf6Q5QN7o2p0raWrmLmoFIxLHPwdNbCpIQeANkPQ%3D&reserved=0 is it happening in every request or only in some cases?

You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Falexanderzobnin%2Fgrafana-zabbix%2Fissues%2F1325%23issuecomment-957223280&data=04%7C01%7Crenato.borges%40via.com.br%7C9c4a0c43a3f74dd44e3f08d99ddc40cb%7C5a86b3fb421349cdb4d6be91482ad3c0%7C0%7C0%7C637714391607477955%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=fiYipsHzu%2Bh9XnhO23u7dPKW%2BHHdtoGz9zNzM%2FsfHJ8%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJX6RRAUTBBPHWCTJK5MFYLUJ6PTFANCNFSM5FOVZ5MA&data=04%7C01%7Crenato.borges%40via.com.br%7C9c4a0c43a3f74dd44e3f08d99ddc40cb%7C5a86b3fb421349cdb4d6be91482ad3c0%7C0%7C0%7C637714391607487903%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=CfvH9XZa2%2FzJjTK%2FIBTXi1hvg1HOtp9CaMoqFcJ13Rw%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Crenato.borges%40via.com.br%7C9c4a0c43a3f74dd44e3f08d99ddc40cb%7C5a86b3fb421349cdb4d6be91482ad3c0%7C0%7C0%7C637714391607497897%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=xcFU0mcfgL7YBCZLziOwAJxW3PNdZHuHXYOlZ6U3p8E%3D&reserved=0 or Androidhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Crenato.borges%40via.com.br%7C9c4a0c43a3f74dd44e3f08d99ddc40cb%7C5a86b3fb421349cdb4d6be91482ad3c0%7C0%7C0%7C637714391607507893%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=1iPiUXV36J6u%2FCSkWCh81%2BRlrJyqR6KOrekIp7FOxPA%3D&reserved=0.

  • Esta mensagem e seus anexos podem conter informação confidencial ou privilegiada, sendo seu sigilo protegido por lei. Caso tenha recebido este e-mail por engano, queira por favor informar imediatamente o remetente e apagá-lo de seus arquivos.
  • Conheça o Código de Conduta Ética da Via Varejo, disponível em: http://ri.viavarejo.com.br/governanca-corporativa/etica-e-compliance/.
  • Dúvidas e denúncias de irregularidades, por favor, contate nosso Canal de Denúncia: https://canaldedenuncia.com.br/viavarejo/, 0800 450 4504 ou @.@.>.
  • This message and its attachments may contain confidential or privileged information protected by law. In case you have received it by mistake, please notify its sender and remove it from your archives.
  • Get to know the Via Varejo Code of Ethical Conduct available at: http://ri.viavarejo.com.br/en/corporate-governance/ethics-and-compliance/.
  • Should you have any questions or reports of misconducts, please contact our etic channel: https://canaldedenuncia.com.br/viavarejo/, 0800 450 4504 or @.@.>.

renatoborges78 avatar Nov 03 '21 11:11 renatoborges78

@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

Mksmpm avatar Nov 03 '21 12:11 Mksmpm

Ok, got it, I will try replicate.

alexanderzobnin avatar Nov 03 '21 13:11 alexanderzobnin

Do you use direct db connection?

alexanderzobnin avatar Nov 24 '21 08:11 alexanderzobnin

Do you use direct db connection?

No, I use API

Mksmpm avatar Nov 24 '21 13:11 Mksmpm

@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

alexanderzobnin avatar Dec 02 '21 14:12 alexanderzobnin

@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

renatoborges78 avatar Dec 09 '21 11:12 renatoborges78

@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

alexanderzobnin avatar Dec 14 '21 11:12 alexanderzobnin

@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 avatar Dec 14 '21 18:12 renatoborges78

@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

renatoborges78 avatar Dec 14 '21 19:12 renatoborges78

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

alexanderzobnin avatar Dec 16 '21 08:12 alexanderzobnin

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?

alexanderzobnin avatar Dec 16 '21 08:12 alexanderzobnin

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

renatoborges78 avatar Dec 17 '21 19:12 renatoborges78

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

Mksmpm avatar Dec 21 '21 07:12 Mksmpm

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.

renatoborges78 avatar Dec 21 '21 15:12 renatoborges78

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

alexanderzobnin avatar Feb 17 '22 13:02 alexanderzobnin

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 avatar Feb 17 '22 21:02 renatoborges78

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

renatoborges78 avatar Sep 14 '22 23:09 renatoborges78

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

alexanderzobnin avatar Jan 04 '23 11:01 alexanderzobnin