记一次zabbix-server服务启动失败处理过程(Zabbix 3.0.9)

注意PID相关的是否是与selinux相关的

在CentOS7x64 7.3.1611上测试部署Zabbix 3.0.9,到启动zabbix-server服务时报错:

[root@CentOS7x64 ~]#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:
[root@CentOS7x64 ~]# 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

                                          

[root@CentOS7x64 ~]# 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.

[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 startzabbix-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: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 [选项] [...]

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)

[root@CentOS7x64 ~]# 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.

[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]# lesszabbix_server.log

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

[root@CentOS7x64 zabbix]#

看日志应该是Zabbix数据库配置不完整,zabbix.users表没有创建,即Zabbix数据库配置时建库建表等动作没有按照要求正常完成。

补充了相关操作后再试,zabbix-server服务启动正常了:

Zabbix管理页面能正常登陆并打开:



你可能感兴趣的:(linux,zabbix)