zabbix 5.2.6不定时重启, 日志报错 failed to open log file: [24] Too many open files
问题说明:zabbix server 不定时重启
问题表现:
1、页面会提示 《 Zabbix server is not running: the information displayed may not be current .》,如下图所示
2、/var/log/message 会提示
systemd: zabbix_server.service: control process exited, code=exited status=1
systemd: Unit zabbix_server.service entered failed state.
systemd: zabbix_server.service failed.
systemd: zabbix_server.service holdoff time over, scheduling restart.
3、/var/log/zabbix_server.log 会提示
zabbix_server [27012]: failed to open log file: [24] Too many open files
zabbix_server [27012]: failed to write [cannot accept incoming IPC connection: [24] Too many open files] into log file
优化方式:
#查找defines.inc.php文件
find / -name defines.inc.php
#编辑defines.inc.php文件 vi /usr/share/
zabbix-ui-5.2.6/include/defines.inc.php
#找到ZBX_MAX_GRAPHS_PER_PAGE 将20该大即可
修改
/etc/security/limits.conf
* soft nofile 655350
* hard nofile 655350
* soft nproc 655350
* hard nproc 655350
修改
/etc/systemd/system.conf 和 /etc/systemd/user.conf
DefaultLimitCORE=infinity
DefaultLimitNOFILE=100000
DefaultLimitNPROC=100000
修改
/etc/sysctl.conf
kernel.sem =500 64000 64 128
fs.file-max = 6553600
执行命令
sysctl -p
systemctl daemon-reload
systemctl daemon-reexec