grafana-zabbix: Parse error Invalid JSON. An error occurred on the server while parsing the JSON text.

Describe the bug Zabbix API cannot be accessed by v4.0.0-alpha4 plugin, while v3.12.2 and older versions could. When saving config of zabbix datasource, the following message appears:

Parse error Invalid JSON. An error occurred on the server while parsing the JSON text.

Expected behavior Datasource configuration should be saved correctly. From grafana server, the following command returns a normal response: curl -k -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"apiinfo.version","params":[],"id":1}' https://zabbix/api_jsonrpc.php returns: {"jsonrpc":"2.0","result":"5.0.1","id":1}

Screenshots Here is my datasource conf, which works properly in stable versions:

image image

The error message that I get when I click on ‘Save & Test’ button:

image

Software versions

Grafana Zabbix Grafana-Zabbix Plugin
7.1.1 5.0.1 4.0.0-alpha4

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 47

Commits related to this issue

Most upvoted comments

@alexanderzobnin Here it is:

image

Here are 2 others examples that are working good, so we can see the differences:

-with postman:

image

-from another zabbix api client:

image

With these outputs, I tried to reproduce the problem on postman by setting the same headers that are set in grafana requests. It seems that if “Content-Length” header is set, it works properly, but if it’s not set, we have the parse error…

Hope this will help

Ok, tried to solve it. Could anyone test it out and confirm that bug fixed? Here’s a built package for all platforms. Just unpack it into grafana plugins folder.

grafana-zabbix-8f70a0c.zip

@mplm17 yes, this super helpful, thanks a lot!

I’ve got managed to replicate this in some cases, but still not sure why that happens. Give me a bit more time to figure it out.