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

17 其他问题

登录及系统守护进程

我们建议创建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

这是由于在/etc/systemd/logind.conf配置文件中默设置RemoveIPC=yes所致。当您退出系统时,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".

此问题有两种解决方案:

  1. (推荐) 停止使用 zabbix 帐户处理除zabbix进程以外的任何事情, 创建专有账户来处理其他事情。
  2. (不推荐) 在/etc/systemd/logind.conf配置文件中,设置 RemoveIPC=no ,并重启系统。 需要注意的是, 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
       # ..