[ZBX-15442] Zabbix proxy ignores DataSenderFrequency Created: 2019 Jan 11  Updated: 2019 Feb 12  Resolved: 2019 Feb 08

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P)
Affects Version/s: None
Fix Version/s: 4.0.5rc1, 4.2.0beta1, 4.2 (plan)

Type: Problem report Priority: Minor
Reporter: Ivan Labáth Assignee: Andrejs Sitals
Resolution: Fixed Votes: 0
Labels: Datasender
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux


Issue Links:
Causes
caused by ZBXNEXT-936 Zabbix Proxy does not proxy remote co... Closed
Team: Team C
Sprint: Sprint 48, Jan 2019, Sprint 49 (Feb 2019)
Story Points: 0.125

 Description   

Steps to reproduce:

  1. Setup zabbix active proxy
  2. set DataSenderFrequency=10 in zabbix_proxy.conf

Result:

Proxy sends data roughly every second - sleeps exactly 1s between seding, often sending exactly 0 items, generating unnecessary traffic.

Expected:

Proxy sleeps 10s.

Description

Issue affects zabbix-proxy 3.4.12. I haven't verified newer versions of proxy, but source on svn://svn.zabbix.com/trunk/src/zabbix_proxy/datasender/datasender.c seems affected.

In ZBX_THREAD_ENTRY(datasender_thread), it updates proctitle as ".. idle $CONFIG_PROXYDATA_FREQUENCY sec", but sleeps only for ZBX_TASK_UPDATE_FREQUENCY (constant 1), and then goes on again to "sending data".

It seems to me, it should sleep CONFIG_PROXYDATA_FREQUENCY.

 
References:

I have searched for relevant bug reports and only found 2 semi-relevant.

One a seemingly misguided request that was rejected.
https://support.zabbix.com/browse/ZBX-9219

Change in the second one might have introduced the bug.
https://support.zabbix.com/browse/ZBX-12668



 Comments   
Comment by Glebs Ivanovskis [ 2019 Jan 11 ]

Probably related to ZBXNEXT-936.

Comment by Andrejs Sitals [ 2019 Jan 28 ]

Looks like process title is misleading. Either zbx_setproctitle() should use ZBX_TASK_UPDATE_FREQUENCY to specify idle time, or it should be extended to include both ZBX_TASK_UPDATE_FREQUENCY and CONFIG_PROYXDATA_FREQUENCY.

As for generating unnecessary traffic which was mentioned in issue's description - proxy not only sends data to the server, but also executes some tasks. Examples of such tasks include "check now" tasks and executing scripts on proxy or on agent via proxy (both scripts from frontend AND scripts that are configured in actions). ZBX_TASK_UPDATE_FREQUENCY controls how often proxy checks if there are tasks to be executed. Currently it's hard-coded (1 second) and cannot be configured in config file.

Comment by Vladislavs Sokurenko [ 2019 Jan 28 ]

(1) [D] Should change documentation so that it explains connections that occur every second regardless of DataSenderFrequency
{quote}
Proxy will send collected data to the server every N seconds.
Active proxy parameter. Ignored for passive proxies (see ProxyMode parameter).
{quote}

Should be changed to:
Proxy will send collected data to the server every N seconds. Please note that Active proxy will still poll Zabbix server every second for remote command tasks.
Active proxy parameter. Ignored for passive proxies (see ProxyMode parameter).

andris Reviewed, seems ok.

martins-v RESOLVED

vso CLOSED

Comment by Ivan Labáth [ 2019 Jan 30 ]

To clarify problem:

Expected:
Proxy sender sleeps 10s.
Or sleeps less, but doesn't send data more often than once in 10s, at least on average, assuming data fits a single request.

Processing scheduled tasks every second seems reasonable, but zabbix_sender AFAICT doesn't connect to agents (nor should it) so task to be executed on agent are irrelevant. As for executing scripts and scheduled tasks, are they actually executed in zabbix_sender (as opposed to say task_manager)? Does it mean adding a "sleep 10" task would make zabbix_sender only send data every 10s? In the sources I see zabbix_sender collecting and transforming task data, but I haven't found any execution, in which case it seems reasonable to me, to gather and send that data every CONFIG_PROXYDATA_FREQUENCY, like all other data.

As for specifics in code, I see zabbix_sender loop only collects host availability, history, discovery and auto registration data (as mentioned in function header) every CONFIG_PROXYDATA_FREQUENCY, but it separately also gathers tasks every second (ZBX_TASK_UPDATE_FREQUENCY) and adds ZBX_DATASENDER_TASKS_REQUEST to flags unconditionally, and then goes on to send/receive .. nothing.

Comment by Ivan Labáth [ 2019 Jan 30 ]

If CONFIG_PROXYDATA_FREQUENCY is not supposed to affect TASKs (not sure why), how about another parameter that would disable or reduce task polling frequency. We don't use tasks and even if we did, waiting a minute for results would not be an issue, but with many proxies and using tls, a connection every second can be quite relevant.

Comment by Andris Mednis [ 2019 Feb 01 ]

Created ZBXNEXT-4998 .

Comment by Andrejs Sitals [ 2019 Feb 05 ]

Available in versions:

  • pre-4.0.5rc1 r89433
  • pre-4.2.0alpha4 (trunk) r89436
Generated at Thu Mar 28 11:02:14 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.