[ZBX-10613] better message(s) for zabbix_get if agent closed connection Created: 2016 Apr 04  Updated: 2017 Nov 02

Status: Open
Project: ZABBIX BUGS AND ISSUES
Component/s: None
Affects Version/s: 3.0.1
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: usability, zabbix_get
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Epic Link: DEV-591

 Description   

A real example:

# zabbix_get -s 127.0.0.1 -k "agent.ping"
1

# zabbix_get -s 127.0.0.1 -k "pg.connect[hostaddr=127.0.0.1 port=6543 user=test,zbx001]"
zabbix_get [29168]: Check access restrictions in Zabbix agent configuration

What happened here - I don't know, maybe the loadable module has simply crashed (ZBX-10428), but I'm sure that the message has to be more technically correct.
I'd change it to:

"Connection has been closed by remote side, 0 bytes has been received.
Most likely access restrictions in Zabbix agent configuration should be checked"

The message is from C code of zabbix_get:

{
      if (0 == bytes_received)
	      zbx_error("Check access restrictions in Zabbix agent configuration");
      ret = FAIL;
}

Note - the message in code is used twice, make sure to sync both places.

Worth to note how zabbix server (3.0) marks the host when agent rejects connections to not allowed server:

Received empty response from Zabbix Agent at [127.0.0.1]. Assuming that agent dropped connection because of access permissions.

Maybe it should be taken as an example for zabbix_get too? Looks like a reasonable approach.

Before version 3.0 zabbix_get printed nothing in such case.



 Comments   
Comment by Glebs Ivanovskis (Inactive) [ 2016 Apr 04 ]

When process() (which we use for ordinary agent checks and module checks both in agent and server/proxy) returns success code but agent fails to extract any text information from result (because agent module tries to return logs or module binary compatibility does not work) agent sends back nothing:

		if (SUCCEED == process(s->buffer, PROCESS_WITH_ALIAS, &result))
		{
			if (NULL != (value = GET_TEXT_RESULT(&result)))
			{
				zabbix_log(LOG_LEVEL_DEBUG, "Sending back [%s]", *value);
				ret = zbx_tcp_send_to(s, *value, CONFIG_TIMEOUT);
			}
		}

Decent error message and response to poller/zabbix_get would be useful here as well.

Comment by Glebs Ivanovskis (Inactive) [ 2016 Dec 01 ]

As discussed in ZBX-11528, it would be nice to use same code in poller and zabbix_get for consistency. And it's reasonable to do it in trunk only as ZBXNEXT or at least in versions no less than 3.0 where encryption and all the logic is in place.

Generated at Fri Jun 06 20:32:02 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.