grafana / grafana-zabbix

Zabbix plugin for Grafana dashboard
http://play.grafana-zabbix.org
Apache License 2.0
2.04k stars 457 forks source link

request failed, status: 500 Internal Server Error #1356

Open N1k-3l opened 2 years ago

N1k-3l commented 2 years ago

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
mbuyukkarakas commented 2 years ago

Hello. I have the same problem.

alexanderzobnin commented 2 years ago

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.

brezzii commented 2 years ago

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 commented 2 years ago

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

N1k-3l commented 2 years ago

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.

jmrodriguezqtn commented 2 years ago

I have the same problem, still no solution?

alexanderzobnin commented 2 years ago

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?

hotoroy commented 2 years ago

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

image
N1k-3l commented 2 years ago

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.

GOID1989 commented 2 years ago

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.

huornlmj commented 1 year ago

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 commented 1 year ago

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.

rfrozza commented 1 year ago

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).

morelattes commented 1 year ago

@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?

Infant-Rashmi commented 1 year ago

@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?

rmsairlock commented 10 months ago

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

rmsairlock commented 4 months ago

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.

Rudorufu-san commented 3 weeks ago

same issue, grafana-zabbix 4.4.9, grafana 11.0, zabbix 6.4.15 Edit sudo nano /etc/postgresql/16/main/postgresql.conf

On item i set preprocesing throtling with hard beat. wait what its do in a month. I like build graph with AVG of all status port on switch with 70p metric per 1m from last 30d and 90d :-)