我们建议 2-创建用户账户 将zabbix 用户设置为系统用户,即不具备登录能力。部分用户 忽略此建议并使用相同账户登录(例如 通过SSH)到运行Zabbix的主机。这可能导致注销时 Zabbix守护进程崩溃。此时您将在Zabbix 服务器日志中get类似以下内容:
zabbix_server [27730]: [file:'selfmon.c',line:375] lock failed: [22] Invalid argument
zabbix_server [27716]: [file:'dbconfig.c',line:5266] lock failed: [22] Invalid argument
zabbix_server [27706]: [file:'log.c',line:238] lock failed: [22] Invalid argument
并在Zabbix agent日志中:
该问题的根源是systemd默认设置RemoveIPC=yes
配置于/etc/systemd/logind.conf
。当您注销系统时, Zabbix先前创建的信号量会被移除,从而导致 崩溃。
引自systemd文档:
RemoveIPC=
控制当用户退出时是否移除属于该用户的System V和POSIX IPCobjects
user fully logs out. Takes a boolean argument. If enabled, the user may not consume IPC resources
after the last of the user's sessions terminated. This covers System V semaphores, shared memory
and message queues, as well as POSIX shared memory and message queues. Note that IPC objects of the
root user and other system users are excluded from the effect of this setting. Defaults to "yes".
此问题有两种解决方案:
/etc/systemd/logind.conf
中设置RemoveIPC=no
并重启系统。请注意RemoveIPC
是系统级 参数,修改它将影响整个系统。如果Zabbix前端运行在proxy服务器之后,需要重写proxy配置中的file的cookie路径以匹配反向代理路径。参见以下示例。如果未重写cookie路径,用户在尝试login到Zabbix前端时可能会遇到授权问题问题。