NO.A.0001——zabbix常见故障的处理

 
问题一:
zabbix-server的运行值为NO,则修改zabbix-server.conf中zabbix-server.conf=127.0.0.1后重启zabbix-server服务即可。
Zabbix server is running NO localhost:10051
//根据如上如上错误提示,表示zabbix Server服务(核心组件)的进行状态是NO,没有监控本地localhost接口地址+10051端口。
解决方法:通过手工方式检测Zabbix_server服务进程和端口号是否启动。
[root@localhost ~]# ps -ef |grep zabbix               //查看它的服务有没有启动
root      15282  78233  0 15:17 pts/1    00:00:00 grep --color=auto zabbix  
 						//grep本身的进程,不算。说明zabbix-server没有启动。
[root@localhost ~]# netstat -tunlp |grep -aw 10051    
		     //查看10051端口号有没有打开, -a是以文本方式显示 -w是只看文本关键词 --color 加上颜色
//显示为空的话,通过手动方式启动zabbix-server服务脚本即可。
[root@localhost ~]# /etc/init.d/zabbix_server restart
[root@localhost ~]# echo $?
0                   //表示执行结果正常。
//OR
或者查看zabbix-server.conf文件配置是否正确
修改zabbix-server.conf中的DBHost=127.0.0.1后重启服务查看结果。
 
问题二、
[root@localhost ~]# /etc/init.d/zabbix_server start
 Can't find file /usr/local/sbin/zabbix_server
 Zabbix server NOT started
根据如上错误的提示,表示启动zabbix server服务时,启动脚本会查找zabbix server主程序文件:/usr/local/sbin/zabix_server。而该文件没有找到,所以zabbix server服务不能启动。
解决方法:
手工方式检测zabbix server主程序是否存在或者权限是否正确;
检查zabbix sever程序是否存在;
[root@localhost ~]# ls -l /usr/local/sbin/zabbix_server
ls:cannot access /usr/local/sbin/sbin/zabbix_server :No such file or directory //说明文件不存在

 [root@localhost ~]# 
 > if [ ! -f /usr/local/sbin/zabbix_server ];> then echo The file does not exist.;fi
The file does not exist     //检测到文件不存在。/若存在什么也不输出。
[root@localhost ~]#if [ -f /usr/local/sbin/zabbix_server ];then echo ok ;fi
OK                      //若存在输出OK
//通过locate或者find工具查找zabbix_server程序的路径&添加软连接。
 [root@localhost ~]# locate zabbix_server
 OR
 [root@localhost ~]# find / -name zabbix_server
  /etc/rc.d/init.d/zabbix_server
/root/zabbix-4.0.25/src/zabbix_server
/root/zabbix-4.0.25/src/zabbix_server/zabbix_server
/root/zabbix-4.0.25/misc/init.d/tru64/zabbix_server
/root/zabbix-4.0.25/misc/init.d/suse/9.3/zabbix_server
/root/zabbix-4.0.25/misc/init.d/suse/9.2/zabbix_server
/root/zabbix-4.0.25/misc/init.d/suse/9.1/zabbix_server
/root/zabbix-4.0.25/misc/init.d/freebsd/zabbix_server
/root/zabbix-4.0.25/misc/init.d/fedora/core/zabbix_server
/root/zabbix-4.0.25/misc/init.d/fedora/core5/zabbix_server
/usr/local/sbin/zabbix_server
/usr/local/zabbix/sbin/zabbix_server
[root@localhost ~]# find / -name zabbix_server |grep -v init |grep -v src 
							// grep -v 排除init、src
OR
[root@localhost ~]# find / -name zabbix_server |grep -vE "init|src"  
 							//或者把两个个grep合在一起,-VE扩展参数。
/usr/local/zabbix/sbin/zabbix_server
//做软连接。
[root@localhost ~]# ln -s /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/
或者直接用上面的命令执行以下for循环。
[root@localhost ~]#> for i in 
> $(find / -name zabbix_server |grep -vE "init|src");do ln -s $i /usr/local/sbin/;done    
           //for i in把这个结果赋值为i这个变量,do开头,done结束,ln -s 软连接$i /usr/local/sbin/
或者用管道符;
[root@localhost ~]# find / -name zabbix_server
>  |grep -vE "init|src" |xargs -I {} ln -s {} /usr/local/sbin/  
    							//xargs -I先把参数传过来,传到大括号,
    							//再用ln -s去调用大括号里面的内容到/usr/local/sbin下。
    
 
问题三:根据以上的解决方案,均无法解决zabbix-server的启动问题时,此时借助zabbix-server软件程序自身的日志来定位问题。
[root@localhost ~]# tail -fn 30 /tmp/zabbix_server.log    //tail -fn 30行来   (背锅侠专用)
[root@localhost ~]# tail -n 30 /tmp/zabbix_server.log                 (推荐使用)
Connection to database 'zabbix'failed:[1045]Access denied for user 
'zabbix'@'localhost'(usring password:NO)
	//根据如上错误的提示,表示:启动zabbix server 服务时,zabbix server主程序会链接后端数据库,
	//通过zabbix用户,通过本地localhost链接,使用空密码链接后端zabbix库,被拒绝访问、
usring password:NO表示没有密码。
解决方法:
登录后端数据库检查zabbix和用户名,密码是否配置正确。
[root@localhost ~]# mysql -uroot -p123456
MariaDB [(none)]> show databases;           //查看库有没有建好
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| zabbix             |
+--------------------+
4 rows in set (0.00 sec)
MariaDB [(none)]> select user,host,password from mysql.user; 
					//在mysql.user表中查看user,password、host三个字段,看是否授权。
+--------+-----------------------+-------------------------------------------+
| user   | host                  | password                                  |
+--------+-----------------------+-------------------------------------------+
| root   | localhost             | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| root   | localhost.localdomain | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| root   | 127.0.0.1             | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| root   | ::1                   | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| zabbix | localhost             | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+--------+-----------------------+-------------------------------------------+
5 rows in set (0.00 sec)
结果:授权了,而且还是有密码。
//查看zabbix_server.conf主程序配置文件看是否配置密码。
[root@localhost ~]# vim /usr/local/zabbix/etc/zabbix_server.conf
DBPassword=   //配置为空。默认安装完是空的。
 
问题四:zabbix_server启动时报错未创建账号:
[root@localhost ~]# /etc/init.d/zabbix_server restart
 zabbix_server [28316]:user zabbix does not exist
 zabbix_server [28316]:cannot run as root!
//创建用户即可
[root@localhost ~]# useradd zabbix
 
问题五:
[root@localhost ~]# /etc/init.d/zabbix_agentd restart
zabbix_agentd [113015]: user zabbix does not exist
zabbix_agentd [113015]: cannot run as root!
Zabbix agent started.
//创建用户和用户组即可:
[root@localhost ~]# groupadd  zabbix
[root@localhost ~]# useradd  -g  zabbix zabbix
[root@localhost ~]# usermod  -s  /sbin/nologin  zabbix
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

<wiz_marker id="wiz-painter-root" style="">

 



posted on   yanqi_vip  阅读(426)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示