Cat /var/log/zabbix/zabbix_server.log
tail -100f xxx.log | grep '2019-10-29 16:4[0-9]' ------查找最新的100行中时间范围在2019-10-29 16:40-2019-10-29 16:49范围中的行
Zabbix监控系统连接的MySQL数据库,无法启动zabbix-server,查看日志发现有如下信息
[Z3001] connection to database 'zabbix' failed: [1040] Too many connections
数据库连接过多,数据库自动退出。
由于MySQL数据库默认连接数较少,所以需要增加默认连接数
进入数据库后:
show variables like 'max_connections';(查可以看当前的最大连接数)
set global max_connections=1000;(设置最大连接数为1000,可以再次查看是否设置成功)
exit(退出)
如果不够,修改my.ini文件[root@xufeng ~]# cat /etc/my.cnf
增加或修改 max_connections=(根据需要填写连接数)
保存退出后,重启mysql的服务service mariadb restart
重启Zabbix-server,系统启动正常。service Zabbix-server restart
ZABBIX:内存溢出导致zabbix-server/zabbix_server 服务启动不起来
[file:dbconfig.c,line:90] zbx_mem_realloc(): out of memory (requested 108424 bytes)
解决:
zabbix内存溢出,
/etc/zabbix/zabbix_server.conf 或者/etc/zabbix/zabbix_agent.conf
添加或修改CacheSize,或CacheSize=8M
改为CacheSize=1024M (这个值根据自己的需求)
重启服务zabbix_server;[root@localhost ~]# service zabbix-server restart
每次重启或者关闭服务器之前记得查看系统使用状态
谁在线:who
联网状态:netstat -a
后台执行的程序:ps -aux
2.通知在线使用者关机时间
shutdown +2 "The machine will shutdown" # 2min 后关机,并通知在线者
若时间不同步执行NTP同步命令保证ZABBIX数据实时显示:
[root@localhost ~]# ntpdate time1.aliyun.com
[root@localhost ~]# date