zabbix server is not running,the information displayed may not be current

在自己的虚拟机上搭建了一个zabbix平台,安装好了相关的php,mysql,apache,zabbix,并使用默认账号admin密码zabbix登录,登录成功之后发现底部出现abbix server is not running,the information displayed may not be current

在这里插入图片描述

通过查找zabbix_server服务是不是启动的,发现自己也启动了呀

[root@localhost conf]# service zabbix_server status
● zabbix_server.service - SYSV: Starts and stops Zabbix Server using chkconfig
   Loaded: loaded (/etc/rc.d/init.d/zabbix_server; bad; vendor preset: disabled)
   Active: active (exited) since 四 2018-12-06 09:01:56 CST; 11min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 37063 ExecStart=/etc/rc.d/init.d/zabbix_server start (code=exited, status=0/SUCCESS)

12月 06 09:01:56 localhost.localdomain systemd[1]: Starting SYSV: Starts and stops Zabbix Server using c......
12月 06 09:01:56 localhost.localdomain zabbix_server[37063]: /etc/rc.d/init.d/zabbix_server : zabbix_serv...ng
12月 06 09:01:56 localhost.localdomain systemd[1]: Started SYSV: Starts and stops Zabbix Server using ch...ig.
Hint: Some lines were ellipsized, use -l to show in full.

刚开始感觉有些奇怪,灵感一动,看看zabbix_server的日志,日志的位置可以从配置文件中查看,默认是LogFile=/tmp/zabbix_server.log

[root@localhost conf]# vi /usr/local/etc/zabbix_server.conf

打开/tmp/zabbix_server.log一看,问题出现了。
一堆类似下面的错误

35124:20181206:091731.737 database is down: reconnecting in 10 seconds
 35124:20181206:091741.738 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
 35124:20181206:091741.738 database is down: reconnecting in 10 seconds
 35124:20181206:091751.739 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
 35124:20181206:091751.739 database is down: reconnecting in 10 seconds
 35124:20181206:091801.740 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
 35124:20181206:091801.741 database is down: reconnecting in 10 seconds

连接不上mysql数据库所致
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=123456
DBPort=3306

保存重启之后,发现日志又变掉了,变成如下的了

37926:20181206:093133.152 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
 37926:20181206:093133.152 database is down: reconnecting in 10 seconds
 37926:20181206:093143.154 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
 37926:20181206:093143.154 database is down: reconnecting in 10 seconds

解决办法
使用root用户登录
mysql -uroot -p

mysql> grant all on zabbix.* to 'zabbix'@'localhost' identified by '123456' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

完后,刷新浏览器,解决了此问题,经验总结,有问题的时候,监控zabbix的日志,会有想不到的收获。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/huangbaokang/article/details/84846970