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

dbasdk發表於2017-06-20
在CentOS7x64 7.3.1611上測試部署Zabbix 3.0.9,到啟動zabbix-server服務時報錯:

[root@CentOS7x64 ~]# systemctl restart zabbix-server

Job for zabbix-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:

[root@CentOS7x64 ~]# journalctl -xe

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

                                           # semodule -i my-zabbixserver.pp

                                           

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

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

-- Subject: Unit zabbix-server.service has begun start-up

-- Defined-By: systemd

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

--

-- Unit zabbix-server.service has begun starting up.

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

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

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

-- Subject: Unit zabbix-server.service has failed

-- 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:52 CentOS7x64 systemd[1]: Unit zabbix-server.service entered failed state.

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

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

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

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

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

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

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

                                          

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

                                          

                                           If you believe that zabbix_server should be allowed setrlimit access on processes labeled zabbix_t by default.

                                           Then you should report this as a bug.

                                           You can 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

                                          

[root@CentOS7x64 ~]# systemctl status zabbix-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-19 15:10:12 CST; 6s ago

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

 

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

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

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

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

[root@CentOS7x64 ~]#

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

Enforcing

[root@CentOS7x64 ~]#

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

Disabled

[root@CentOS7x64 ~]# sestatus

SELinux status:                 disabled

[root@CentOS7x64 ~]#

[root@CentOS7x64 ~]# systemctl start zabbix-server

[root@CentOS7x64 ~]# ps -ef | grep zabbix

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

[root@CentOS7x64 ~]# journalctl -xe

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

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

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

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

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

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

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

-- Subject: Unit zabbix-server.service has begun start-up

-- Defined-By: systemd

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

--

-- Unit zabbix-server.service has begun starting up.

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

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

-- Subject: Unit zabbix-server.service has finished start-up

-- Defined-By: systemd

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

--

-- Unit zabbix-server.service has finished starting up.

--

-- The start-up result is done.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[root@CentOS7x64 ~]# systemctl status zabbix-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-19 15: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)

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

 

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

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

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

[root@CentOS7x64 ~]# getenforce

Disabled

[root@CentOS7x64 ~]#


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

[root@CentOS7x64 ~]# cd /var/log

[root@CentOS7x64 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

[root@CentOS7x64 log]# cd  zabbix

[root@CentOS7x64 zabbix]# ls

zabbix_server.log

[root@CentOS7x64 zabbix]# ll

總用量 384

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

[root@CentOS7x64 zabbix]# less zabbix_server.log

[root@CentOS7x64 zabbix]# tail -50 zabbix_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] query failed: [1146] Table 'zabbix.users' doesn't exist [select userid from users limit 1]

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

  4531:20170619:160634.563 Starting Zabbix Server. 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 configuration file: /etc/zabbix/zabbix_server.conf

  4531:20170619:160634.567 [Z3005] query failed: [1146] Table 'zabbix.users' doesn't exist [select userid from users limit 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 (revision 67444).

  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.820 VMware 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 configuration file: /etc/zabbix/zabbix_server.conf

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

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

[root@CentOS7x64 zabbix]#

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

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

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




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29734436/viewspace-2140993/,如需轉載,請註明出處,否則將追究法律責任。

相關文章