-
Type:
Problem report
-
Resolution: Unresolved
-
Priority:
Trivial
-
None
-
Affects Version/s: 7.0.33rc1, 7.4.17rc1, 8.0.0rc3
-
Component/s: Agent (G)
-
None
-
Environment:Ubuntu 24.04.5 LTS, x86_64 (kernel 7.0.0-38-generic)
Zabbix server 8.0.0rc3 (package 2:8.0.0~rc3-1+ubuntu24.04), PostgreSQL 16.15
Zabbix agent built from source with "configure --enable-agent" (gcc 13.3.0, PCRE2 10.42, no TLS):
- 6.0.50rc1 (release/6.0 @ b74ab66739f)
- 7.0.33rc1 (release/7.0 @ 19817086a75)
- 7.4.17rc1 (release/7.4 @ 53a177c9fb2)
- 8.0.0rc3 (master @ 1ae8298d2a3)
Zabbix agent 2 8.0.0rc3 (package 2:8.0.0~rc3-1+ubuntu24.04)
zabbix_get 8.0.0rc3Ubuntu 24.04.5 LTS, x86_64 (kernel 7.0.0-38-generic) Zabbix server 8.0.0rc3 (package 2:8.0.0~rc3-1+ubuntu24.04), PostgreSQL 16.15 Zabbix agent built from source with "configure --enable-agent" (gcc 13.3.0, PCRE2 10.42, no TLS): - 6.0.50rc1 (release/6.0 @ b74ab66739f) - 7.0.33rc1 (release/7.0 @ 19817086a75) - 7.4.17rc1 (release/7.4 @ 53a177c9fb2) - 8.0.0rc3 (master @ 1ae8298d2a3) Zabbix agent 2 8.0.0rc3 (package 2:8.0.0~rc3-1+ubuntu24.04) zabbix_get 8.0.0rc3
Steps:
1. zabbix_agentd.conf: ServerActive=<server>, Hostname=hostA,hostB
2. Hosts hostA and hostB, each with an active agent.hostname item
3. zabbix_get -s <agent> -k agent.hostname
Quicker: zabbix_agentd -c zabbix_agentd.conf -t agent.hostname
Expected (per the agent.hostname documentation; as in 6.0 and agent 2): hostA's item returns hostA, hostB's item returns hostB; the passive check and -t return hostA.
Actual: all return hostB. Without ServerActive, the passive check and -t return hostA.
Cause: add_serveractive_host_agent_cb() (add_serveractive_host_cb() in 7.0) in src/zabbix_agent/zabbix_agentd.c sets the thread-local zbx_config_hostname in the main process for each hostname; forked processes inherit the last value, and the active checks process never sets its own (6.0 set CONFIG_HOSTNAME in the active checks thread). Introduced in 7.0.0alpha3 by DEV-2176 (0fdca1f78f9, b1d78d625ce). On Windows (by code), worker threads start with zbx_config_hostname unset, so all return the first hostname: hostB's active item returns hostA.