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

request failed, status: 500 Internal Server Error

Open N1k-3l opened this issue 3 years ago • 18 comments

Describe the bug When try to get metrics from group of hosts (more than 50) --> Error 'request failed, status: 500 Internal Server Error' Can it be from plugin error, because with old (3version) plugin it worked normal?

Log

t=2021-12-04T16:09:53+0300 lvl=dbug msg="Publication successful" logger=live user=16 channel=grafana/dashboard/uid/dtx8-Ednk
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Querying for data source via SQL store" logger=datasources id=5 orgId=1
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Initializing new data source instance" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Zabbix request" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource method=apiinfo.version
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Got Zabbix version" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource version=54.000
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Zabbix request" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource method=apiinfo.version
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Zabbix request" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource method=hostgroup.get
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Successfully authenticated" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource url=http://ZABBBIX_XXX/api_jsonrpc.php user=XXX
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Zabbix request" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource method=hostgroup.get
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Writing result to cache" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource method=hostgroup.get
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Zabbix request" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource method=host.get
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Writing result to cache" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource method=host.get
t=2021-12-04T16:09:53+0300 lvl=dbug msg="Zabbix request" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource method=item.get
t=2021-12-04T16:09:59+0300 lvl=eror msg="Zabbix API request error" logger=plugins.backend pluginId=alexanderzobnin-zabbix-datasource error="request failed, status: 500 Internal Server Error"
t=2021-12-04T16:09:59+0300 lvl=eror msg="Request Completed" logger=context userId=16 orgId=1 uname=XXXXX method=POST path=/api/datasources/5/resources/zabbix-api status=500 remote_addr=XXX.XXX.XXX.XXX time_ms=5375 size=95 referer="https://grafana.XXX.ru/d/dtx8-Ednk/network-interfaces-utilization?orgId=1&editPanel=4"

Screenshots

request failed, status: 500 Internal Server Error Object status:500 statusText:"Internal Server Error" data:Object error:"Internal Server Error" message:"request failed, status: 500 Internal Server Error" config:Object url:"api/datasources/5/resources/zabbix-api" method:"POST" headers:Object hideFromInspector:false data:Object retry:0 message:"request failed, status: 500 Internal Server Error" image

image

Software versions

Grafana Zabbix Grafana-Zabbix Plugin
8.2.5 5.4.8 4.2.4

N1k-3l avatar Dec 04 '21 13:12 N1k-3l

Hello. I have the same problem.

mbuyukkarakas avatar Dec 04 '21 13:12 mbuyukkarakas

It looks like Zabbix API cannot handle request. Try to tweak PHP settings and increase amount of memory assigned to PHP. I appreciate if you can make the same request in grafana with 3.x plugin version to make sure it's something that works in a different way in the new plugin versions with backend.

alexanderzobnin avatar Dec 20 '21 10:12 alexanderzobnin

Hello @alexanderzobnin why it was working before with the same php settings as am using now ? does the amount of data affects the API Call ? Regards

brezzii avatar Dec 20 '21 10:12 brezzii

By the way our php memory settings are 10 G and we still have the same issue

brezzii avatar Dec 20 '21 10:12 brezzii

It looks like Zabbix API cannot handle request. Try to tweak PHP settings and increase amount of memory assigned to PHP. I appreciate if you can make the same request in grafana with 3.x plugin version to make sure it's something that works in a different way in the new plugin versions with backend.

I tweaked up PHP settings, but grafana doesn't get metrics, only freeze and stop working during 2-5 minutes. No errors, but no metrics.

N1k-3l avatar Dec 23 '21 09:12 N1k-3l

I have the same problem, still no solution?

jmrodriguezqtn avatar Mar 11 '22 10:03 jmrodriguezqtn

Hm, that's strange, I will try to investigate. Can you provide a bit more info, is it happening only on large amount of data?

alexanderzobnin avatar Apr 27 '22 14:04 alexanderzobnin

Hi! I have same error. I'm trying to get data on 1 item for 150 hosts. image

hotoroy avatar May 12 '22 12:05 hotoroy

Hm, that's strange, I will try to investigate. Can you provide a bit more info, is it happening only on large amount of data?

Yes. As I wrote in the description, this problem only occurs when the group contains over ~50 hosts.

N1k-3l avatar Jun 12 '22 09:06 N1k-3l

Have same problem on zabbix 6.0.3 + grafana 8.5.2 + plugin 4.2.8 Does not matter with OR without "direct db"

But! Identical panel (table type) with DS connected to zabbix 5.0.10 work correct

After changing php param php_value[memory_limit] = 1024M few panel showing correct, but not all.

Php error log when choosing memory level: `[15-Jun-2022 21:14:25] WARNING: [pool zabbix] child 3288729 said into stderr: "NOTICE: PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /usr/share/zabbix/include/classes/api/CRelationMap.php on line 48"

[15-Jun-2022 21:15:10] WARNING: [pool zabbix] child 3289012 said into stderr: "NOTICE: PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /usr/share/zabbix/include/db.inc.php on line 404"`

Maybe problem in filter passed by grafana plugin ? Because on this zabbix i have bunch of scripts grabs info by API - all host, all host trigger, all host items at same time and it works.

GOID1989 avatar Jun 15 '22 15:06 GOID1989

I have the same issue when trying to poll a large amount of hosts with a single item per host. If I select a time window of 3 hours I get my data, if I extend that to 6 hours I get error 500 and "no data" (error:"request failed, status: 500 Internal Server Error"). I don't know if it's Grafana or Zabbix that's throwing this 500 error as it's not showing up in either of their log files.

huornlmj avatar Dec 01 '22 10:12 huornlmj

UPDATE - I found that if I decreased the frequency at which Zabbix polls the monitored hosts from every 1 minute to every 5 minutes and leave it for 24 hours, I can now go back to Grafana and graph those hosts up as far as 12 hours. But anything more than 12 hours (e.g. 24 hours) and I start getting the error 500 again. It must be to do with the volume of data being retrieved.

huornlmj avatar Dec 02 '22 12:12 huornlmj

I was receiving the same error, but increasing the parameter php_value memory_limit to 1024M inside zabbix.conf file resolved the issue for me. /etc/apache2/conf-enabled/zabbix.conf Tested with a dashboard with +200 hosts and 6 hours as time range Zabbix v6.2.3 and Grafana v9.2.5 And the setup is running on AWS, with RDS for MySQL and two EC2 instances (one for zabbix server and one for zabbix frontend).

rfrozza avatar Dec 28 '22 17:12 rfrozza

@alexanderzobnin Still facing this issue on grafana-zabbix 4.2.10, grafana 8.0 and zabbix 6.2 (tried everything mentioned in the comments). Any commits related to this?

morelattes avatar May 04 '23 07:05 morelattes

@alexanderzobnin facing the same issue, on grafana-zabbix 4.2.10, grafana 9.4.7 and zabbix 6.2. Could you please look into it?

Infant-Rashmi avatar May 11 '23 06:05 Infant-Rashmi

@alexanderzobnin same issue, grafana-zabbix 4.4.1, grafana 10.1, zabbix 6.4.6

rmsairlock avatar Sep 05 '23 17:09 rmsairlock

Just wondering, was this ever figured out? I still have the issue when getting a value from around 400 servers, if the host isn't a wild card the query/results run fine.

rmsairlock avatar Feb 27 '24 04:02 rmsairlock