1. 程式人生 > >記一次zabbix-server服務啟動失敗處理過程(Zabbix 3.0.9)

記一次zabbix-server服務啟動失敗處理過程(Zabbix 3.0.9)

注意PID相關的是否是與selinux相關的

在CentOS7x64 7.3.1611上測試部署Zabbix 3.0.9,到啟動zabbix-server服務時報錯:

[[email protected] ~]#systemctl restart zabbix-server

Job forzabbix-server.service failed because a configured resource limit was exceeded.See "systemctl status zabbix-server.service" and "journalctl-xe" for details.



按提示執行了systemctl status zabbix-server.servicejournalctl -xe:
[[email protected] ~]# journalctl -xe

                                           #ausearch -c 'zabbix_server' --raw | audit2allow -M my-zabbixserver

                                           #semodule -i my-zabbixserver.pp

6月 19 15:09:51CentOS7x64 systemd[1]: zabbix-server.service holdoff time over, schedulingrestart.

6月 19 15:09:51CentOS7x64 systemd[1]: Starting Zabbix Server...

-- Subject: Unit zabbix-server.service hasbegun start-up

-- Defined-By: systemd

-- Support:http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit zabbix-server.service has begunstarting up.

6月 19 15:09:52CentOS7x64 systemd[1]: PID file /run/zabbix/zabbix_server.pid not readable(yet?) after start.

6月 19 15:09:52CentOS7x64 systemd[1]: zabbix-server.service never wrote its PID file. Failing.

6月 19 15:09:52 CentOS7x64 systemd[1]: Failed to start ZabbixServer.

-- Subject: Unit zabbix-server.service hasfailed

-- Defined-By: systemd

-- Support:http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit zabbix-server.service has failed.

--

-- The result is failed.

6月 19 15:09:52CentOS7x64 systemd[1]: Unit zabbix-server.service entered failed state.

6月 19 15:09:52CentOS7x64 systemd[1]: zabbix-server.service failed.

6月 19 15:09:55CentOS7x64 dbus[533]: [system] Activating servicename='org.fedoraproject.Setroubleshootd' (using servicehelper)

6月 19 15:09:55CentOS7x64 dbus-daemon[533]: dbus[533]: [system] Activating servicename='org.fedoraproject.Setroubleshootd' (using servicehelper)

6月 19 15:09:55CentOS7x64 dbus[533]: [system] Successfully activated service'org.fedoraproject.Setroubleshootd'

6月 19 15:09:55CentOS7x64 dbus-daemon[533]: dbus[533]: [system] Successfully activated service'org.fedoraproject.Setroubleshootd'

6月 19 15:09:55 CentOS7x64 setroubleshoot[11641]: SELinux ispreventing zabbix_server from using the setrlimit access on a process. Forcomplete SELinux messa

6月 19 15:09:55 CentOS7x64 python[11641]: SELinux is preventingzabbix_server from using the setrlimit access on a process.

                                          *****  Plugin catchall (100.confidence) suggests  **************************

                                           Ifyou believe that zabbix_server should be allowed setrlimit access on processeslabeled zabbix_t by default.

                                           Thenyou should report this as a bug.

                                           Youcan generate a local policy module to allow this access.

                                           Do

                                          allow this access for now by executing:

                                           #ausearch -c 'zabbix_server' --raw | audit2allow -M my-zabbixserver

                                           #semodule -i my-zabbixserver.pp

[[email protected] ~]# systemctl statuszabbix-server

● zabbix-server.service - Zabbix Server

  Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled;vendor preset: disabled)

  Active: activating (auto-restart) (Result: resources) since 一 2017-06-1915:10:12 CST; 6s ago

 Process: 11671 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE(code=exited, status=0/SUCCESS)

6月 19 15:10:12CentOS7x64 systemd[1]: zabbix-server.service never wrote its PID file. Failing.

6月 19 15:10:12CentOS7x64 systemd[1]: Failed to start Zabbix Server.

6月 19 15:10:12CentOS7x64 systemd[1]: Unit zabbix-server.service entered failed state.

6月 19 15:10:12CentOS7x64 systemd[1]: zabbix-server.service failed.

[[email protected] ~]#

看提示中提到SElinux,檢查發現確實沒有關閉SELinux:
[[email protected] ~]#getenforce

Enforcing

[[email protected]~]#

按要求關閉SELinux後再嘗試啟動zabbix-server服務:
[[email protected] ~]# getenforce

Disabled

[[email protected] ~]# sestatus

SELinux status:                 disabled

[[email protected]~]#

[[email protected] ~]# systemctl startzabbix-server

[[email protected] ~]# ps -ef | grep zabbix

root     3820  3660  0 15:52 pts/0    00:00:00 grep --color=auto zabbix

[[email protected] ~]# journalctl -xe

6月 19 15:52:03CentOS7x64 systemd[1]: zabbix-server.service: control process exited,code=exited status=1

6月 19 15:52:03CentOS7x64 systemd[1]: Unit zabbix-server.service entered failed state.

6月 19 15:52:03CentOS7x64 systemd[1]: zabbix-server.service failed.

6月 19 15:52:05CentOS7x64 dhclient[3801]: DHCPDISCOVER on enp0s10 to 255.255.255.255 port 67interval 4 (xid=0x46084d72)

6月 19 15:52:09CentOS7x64 dhclient[3801]: DHCPDISCOVER on enp0s10 to 255.255.255.255 port 67interval 5 (xid=0x46084d72)

6月 19 15:52:13 CentOS7x64systemd[1]: zabbix-server.service holdoff time over, scheduling restart.

6月 19 15:52:13CentOS7x64 systemd[1]: Starting Zabbix Server...

-- Subject: Unit zabbix-server.service hasbegun start-up

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit zabbix-server.service has begunstarting up.

6 19 15:52:13CentOS7x64 systemd[1]: PID file /run/zabbix/zabbix_server.pid not readable(yet?) after start.

6月 19 15:52:13CentOS7x64 systemd[1]: Started Zabbix Server.

-- Subject: Unit zabbix-server.service hasfinished start-up

-- Defined-By: systemd

-- Support:http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit zabbix-server.service has finishedstarting up.

--

-- The start-up result is done.

6 19 15:52:13CentOS7x64 systemd[1]: zabbix-server.service: main process exited, code=exited,status=1/FAILURE

6月 19 15:52:13CentOS7x64 kill[3817]: 用法:

6月 19 15:52:13CentOS7x64 kill[3817]: kill [選項] <pid|名稱> [...]

6月 19 15:52:13CentOS7x64 kill[3817]: 選項:

6月 19 15:52:13CentOS7x64 kill[3817]: -a, --all              不限於只對和當前程序的使用者 id 相同的程序進行

6月 19 15:52:13CentOS7x64 kill[3817]: 名稱-程序id 轉換

6月 19 15:52:13CentOS7x64 kill[3817]: -s, --signal <訊號>     傳送指定的訊號

6月 19 15:52:13CentOS7x64 kill[3817]: -q, --queue <訊號>      使用 sigqueue(2) 代替 kill(2)

6月 19 15:52:13CentOS7x64 kill[3817]: -p, --pid              列印 pid 而不向它們傳送訊號

6月 19 15:52:13CentOS7x64 kill[3817]: -l, --list [=<訊號>]   列出訊號名,或將一個訊號轉換為名稱

6月 19 15:52:13 CentOS7x64kill[3817]: -L, --table            列出訊號名和數值

6月 19 15:52:13CentOS7x64 kill[3817]: -h, --help     顯示此幫助並退出

6月 19 15:52:13CentOS7x64 kill[3817]: -V, --version  輸出版本資訊並退出

6月 19 15:52:13CentOS7x64 kill[3817]: 更多資訊請參閱 kill(1)。

6月 19 15:52:13CentOS7x64 systemd[1]: zabbix-server.service: control process exited,code=exited status=1

6月 19 15:52:13CentOS7x64 systemd[1]: Unit zabbix-server.service entered failed state.

6月 19 15:52:13CentOS7x64 systemd[1]: zabbix-server.service failed.

6月 19 15:52:14 CentOS7x64dhclient[3801]: DHCPDISCOVER on enp0s10 to 255.255.255.255 port 67 interval 8(xid=0x46084d72)

[[email protected] ~]# systemctl statuszabbix-server

● zabbix-server.service - Zabbix Server

  Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled;vendor preset: disabled)

  Active: activating (auto-restart) (Result: exit-code) since 一 2017-06-1915:52:24 CST; 3s ago

 Process: 3826 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited,status=1/FAILURE)

 Process: 3823 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE(code=exited, status=0/SUCCESS)

 MainPID: 3825 (code=exited, status=1/FAILURE)

6 19 15:52:24CentOS7x64 systemd[1]: zabbix-server.service: control process exited,code=exited status=1

6 19 15:52:24CentOS7x64 systemd[1]: Unit zabbix-server.service entered failed state.

6 19 15:52:24CentOS7x64 systemd[1]: zabbix-server.service failed.

[[email protected] ~]# getenforce

Disabled

[[email protected] ~]#


這次執行啟動命令沒有報錯提示,執行systemctl status zabbix-server.servicejournalctl -xe也沒有明顯的錯誤原因提示。

[[email protected] ~]# cd /var/log

[[email protected] log]# ls

anaconda       cups                httpd              pluto             speech-dispatcher        VBoxGuestAdditions-uninstall.log  Xorg.9.log

audit          dmesg               lastlog            pm-powersave.log  spooler                  vmware-vmusr.log                  Xorg.9.log.old

boot.log       dmesg.old           libvirt            ppp               spooler-20170417         wpa_supplicant.log                yum.log

btmp           firewalld           maillog            qemu-ga           tallylog                 wtmp                              yum.log-20170417

btmp-20170417  gdm                 maillog-20170417   sa                tuned                    Xorg.0.log                        zabbix

chrony         glusterfs           messages           samba             vboxadd-install.log      Xorg.0.log.old

cron           grubby              messages-20170417  secure            vboxadd-install-x11.log  Xorg.1.log

cron-20170417  grubby_prune_debug  mysqld.log         secure-20170417   VBoxGuestAdditions.log   Xorg.1.log.old

[[email protected] log]# cd  zabbix

[[email protected] zabbix]# ls

zabbix_server.log

[[email protected] zabbix]# ll

總用量 384

-rw-rw-r--. 1 zabbix zabbix 368295 6月  19 16:04 zabbix_server.log

[[email protected] zabbix]# lesszabbix_server.log

[[email protected] zabbix]# tail -50zabbix_server.log

 4520:20170619:160624.303 ****** Enabled features ******

 4520:20170619:160624.303 SNMP monitoring:           YES

 4520:20170619:160624.303 IPMI monitoring:           YES

 4520:20170619:160624.303 Web monitoring:            YES

 4520:20170619:160624.303 VMware monitoring:         YES

 4520:20170619:160624.303 SMTP authentication:       YES

 4520:20170619:160624.303 Jabber notifications:      YES

 4520:20170619:160624.303 Ez Texting notifications:  YES

 4520:20170619:160624.303 ODBC:                      YES

 4520:20170619:160624.303 SSH2 support:              YES

 4520:20170619:160624.303 IPv6 support:              YES

 4520:20170619:160624.303 TLS support:               YES

 4520:20170619:160624.303 ******************************

 4520:20170619:160624.303 using configuration file:/etc/zabbix/zabbix_server.conf

  4520:20170619:160624.306 [Z3005] queryfailed: [1146] Table 'zabbix.users' doesn't exist [select userid from userslimit 1]

  4520:20170619:160624.306 cannot use database"zabbix": database is not a Zabbix database

  4531:20170619:160634.563 Starting ZabbixServer. Zabbix 3.0.9 (revision 67444).

 4531:20170619:160634.563 ****** Enabled features ******

 4531:20170619:160634.563 SNMP monitoring:           YES

 4531:20170619:160634.563 IPMI monitoring:           YES

 4531:20170619:160634.563 Web monitoring:            YES

 4531:20170619:160634.563 VMware monitoring:         YES

 4531:20170619:160634.563 SMTP authentication:       YES

 4531:20170619:160634.563 Jabber notifications:      YES

 4531:20170619:160634.563 Ez Texting notifications:  YES

 4531:20170619:160634.563 ODBC:                      YES

 4531:20170619:160634.563 SSH2 support:              YES

 4531:20170619:160634.563 IPv6 support:              YES

 4531:20170619:160634.563 TLS support:               YES

 4531:20170619:160634.563 ******************************

  4531:20170619:160634.563 using configurationfile: /etc/zabbix/zabbix_server.conf

  4531:20170619:160634.567 [Z3005] queryfailed: [1146] Table 'zabbix.users' doesn't exist [select userid from userslimit 1]

 4531:20170619:160634.567 cannot use database "zabbix":database is not a Zabbix database

 4536:20170619:160644.820 Starting Zabbix Server. Zabbix 3.0.9 (revision67444).

 4536:20170619:160644.820 ****** Enabled features ******

 4536:20170619:160644.820 SNMP monitoring:           YES

 4536:20170619:160644.820 IPMI monitoring:           YES

 4536:20170619:160644.820 Web monitoring:            YES

  4536:20170619:160644.820VMware monitoring:         YES

 4536:20170619:160644.820 SMTP authentication:       YES

 4536:20170619:160644.820 Jabber notifications:      YES

 4536:20170619:160644.820 Ez Texting notifications:  YES

 4536:20170619:160644.820 ODBC:                      YES

 4536:20170619:160644.820 SSH2 support:              YES

 4536:20170619:160644.820 IPv6 support:              YES

 4536:20170619:160644.820 TLS support:               YES

 4536:20170619:160644.820 ******************************

  4536:20170619:160644.820 using configurationfile: /etc/zabbix/zabbix_server.conf

  4536:20170619:160644.826 [Z3005] queryfailed: [1146] Table 'zabbix.users' doesn't exist [select userid from userslimit 1]

 4536:20170619:160644.826 cannot use database "zabbix":database is not a Zabbix database

[[email protected] zabbix]#

看日誌應該是Zabbix資料庫配置不完整,zabbix.users表沒有建立,即Zabbix資料庫配置時建庫建表等動作沒有按照要求正常完成。

補充了相關操作後再試,zabbix-server服務啟動正常了:

Zabbix管理頁面能正常登陸並開啟: