[ZBX-22069] zabbix_agent2 plugin socket changes ownership after RT command run Created: 2022 Dec 12 Updated: 2024 Apr 10 Resolved: 2023 Feb 09 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G) |
Affects Version/s: | 6.0.12 |
Fix Version/s: | 6.0.14rc1, 6.2.8rc1, 6.4.0rc1, 6.4 (plan) |
Type: | Problem report | Priority: | Trivial |
Reporter: | Hayato Watanabe | Assignee: | Juris Lambda |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
CentOS stream 8 |
Issue Links: |
|
||||||||||||||||
Team: | |||||||||||||||||
Sprint: | Sprint 95 (Dec 2022), Sprint 96 (Jan 2023) | ||||||||||||||||
Story Points: | 1 |
Description |
[root@localhost tmp]# zabbix_agent2 -V | grep zabbix_agent2 zabbix_agent2 (Zabbix) 6.0.12 [root@localhost tmp]# ls -al /tmp/agent.* srwxr-xr-x 1 zabbix zabbix 0 Dec 12 06:52 /tmp/agent.plugin.sock srwx------ 1 zabbix zabbix 0 Dec 12 06:52 /tmp/agent.sock [root@localhost tmp]# zabbix_agent2 -R userparameter_reload 2022/12/12 06:56:18.295337 User parameters reloaded [root@localhost tmp]# ls -al /tmp/agent.* srwxr-xr-x 1 root root 0 Dec 12 06:56 /tmp/agent.plugin.sock srwx------ 1 zabbix zabbix 0 Dec 12 06:52 /tmp/agent.sock [root@localhost tmp]# systemctl stop zabbix-agent2 Plugin files cannot be deleted because the owner is root. [root@localhost tmp]# ls -al /tmp/agent.* srwxr-xr-x 1 root root 0 Dec 12 06:56 /tmp/agent.plugin.sock zabbix_agent2.log 2022/12/12 06:52:48.228652 Zabbix Agent2 hostname: [Zabbix server] 2022/12/12 06:52:49.230741 [101] cannot connect to [127.0.0.1:10051]: dial tcp :0->127.0.0.1:10051: connect: connection refused 2022/12/12 06:52:49.230782 [101] active check configuration update from host [Zabbix server] started to fail 2022/12/12 06:56:18.295252 User parameters reloaded 2022/12/12 06:58:45.017758 Zabbix Agent 2 stopped. (6.0.12) 2022/12/12 06:58:45.017824 failed to clean up after plugins, operation not permitted |
Comments |
Comment by Juris Lambda [ 2022 Dec 21 ] |
What immediately struck me was the fact that the user is mixing controls. What is actually happening is that the user invokes zabbix_agent2 -R ... as root, and because we're hasty to create sockets, the original socket gets replaced by a new one, as the external plugin configuration is loaded. Only later do we process the runtime command and send the signal. One could argue that once the agent is run as a managed service, the system administrator should remain within the realm of system management utilities and a la systemctl restart zabbix-agent2.service instead. This makes me wonder if -R should be designated as a development process oriented flag, and not for general use, where the agents runtime is managed somehow. Switching to processing runtime mode should probably happen earlier, preferably right after processing configuration and before logging (as we're running a control command, and are there to see stdout). Creation of resources such as sockets should generally be held off as late as possible in the bootstrapping sequence. |
Comment by Juris Lambda [ 2022 Dec 21 ] |
Bug report |
Comment by Marina Generalova [ 2023 Jan 31 ] |
Documentation updated: |