启动zabbix-server/agent报错:cannot open "/etc/zabbix/logs/zabbix_server.log": [13] Permission denied
注:该报错解决方式同样适用于zabbix-agent
启动zabbix-server报错信息如下:
2月 27 16:52:44 localhost.localdomain zabbix_server[15087]: zabbix_server [15089]: cannot open "/etc/zabbix/logs/zabbix_server.log": [13] Permission denied 2月 27 16:52:44 localhost.localdomain systemd[1]: Can't open PID file /run/zabbix/zabbix_server.pid (yet?) after start:No such file or directory 2月 27 16:52:44 localhost.localdomain systemd[1]: zabbix-server.service never wrote its PID file. Failing. 2月 27 16:52:44 localhost.localdomain systemd[1]: Failed to start Zabbix Server.
查询zabbix_server.log日志发现:
zabbix_server [3398]: cannot open "/etc/zabbix/logs/zabbix_server.log": [13] Permission denied zabbix_server [3398]: cannot open "/etc/zabbix/logs/zabbix_server.log": [13] Permission denied zabbix_server [3398]: failed to open log file: [13] Permission denied zabbix_server [3398]: failed to write [failed to accept an incoming connection: select() failed: [4] Interruptstem call] into log file
由此可以初步判断是由于权限分配的问题导致zabbix服务器启动失败,参考日志报错信息:这一点很重要,权限分配问题导致!
改变相应目录和文件的属组,属于root用户,同属zabbix组:
chown root:zabbix logs
chown root:zabbix zabbix_agentd.conf
chown root:zabbix zabbix_server.conf
再重启zabbix服务即可:
systemctl restart zabbix-server