这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

15 其他问题

Login 和 systemd

我们建议创建 一个 zabbix用户作为系统用户,但不允许登录。一些用户忽略此建议并使用相同的帐户登录(例如使用 SSH)来登录运行 Zabbix 的主机。这可能会使 Zabbix 守护进程在注销时崩溃。在这种情况下,您将在 Zabbix server 日志中获得类似以下内容:

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 日志中:

zabbix_agentd [27796]: [file:'log.c',line:238] lock failed: [22] Invalid argument

这是因为默认的 systemd 设置 RemoveIPC=yes/etc/systemd/logind.conf中配置。 当您退出系统时,Zabbix 之前创建的信号量会被删除,这会导致崩溃。

来自 systemd 文档的引用:

RemoveIPC=
       
       Controls whether System V and POSIX IPC objects belonging to the user shall be removed when the
       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".

这个问题有2个解决方案:

  1. (推荐)停止使用zabbix 帐户来处理除 Zabbix 进程之外的任何事情,为其他事情创建一个专用帐户。
  2. (不推荐)设置RemoveIPC=no/etc/systemd/logind.conf中并重新启动系统。 请注意, RemoveIPC 是一个系统范围的参数,更改它会影响整个系统。

在代理后面使用 Zabbix 前端

如果 Zabbix 前端在代理服务器后面运行,则需要重写代理配置文件中的 cookie 路径以匹配反向代理路径。请参阅下面的示例。如果不重写 cookie 路径,用户在尝试登录 Zabbix 前端时可能会遇到授权问题。

nginx 的示例配置
# ..
       location / {
       # ..
       proxy_cookie_path /zabbix /;
       proxy_pass http://192.168.0.94/zabbix/;
       # ..
Apache 的示例配置
# ..
       ProxyPass "/" http://host/zabbix/
       ProxyPassReverse "/" http://host/zabbix/
       ProxyPassReverseCookiePath /zabbix /
       ProxyPassReverseCookieDomain host zabbix.example.com
       # ..