NO.A.0001——zabbix常見故障的處理
阿新 • • 發佈:2020-11-18
問題一: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)