一台服务器的Zabbix Agent升级后,在Zabbix Server发现Zabbix Agent无法访问。检查Zabbix Agent发现服务停止了,启动Zabbix Agent后,发现服务马上又异常了。遂检查日志发现有下面错误:
26033:20200709:163321.520 Starting Zabbix Agent [xxxx]. Zabbix 5.0.1 (revision c2a0b03480).
26033:20200709:163321.521 **** Enabled features ****
26033:20200709:163321.521 IPv6 support: YES
26033:20200709:163321.521 TLS support: NO
26033:20200709:163321.521 **************************
26033:20200709:163321.521 using configuration file: /etc/zabbix/zabbix_agentd.conf
26033:20200709:163321.530 listener failed: zbx_tcp_listen() fatal error: unable to serve on any address [[-]:10050]
26033:20200709:163321.530 Zabbix Agent stopped. Zabbix 5.0.1 (revision c2a0b03480).
检查进程,发现Zabbix Agent的相关进程还在
# ps -ef | grep zabbix
zabbix 4204 1 0 May31 ? 00:09:36 /usr/local/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 4205 1 0 May31 ? 00:03:53 /usr/local/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 4206 1 0 May31 ? 00:03:49 /usr/local/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 4207 1 0 May31 ? 00:03:53 /usr/local/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 4208 1 0 May31 ? 00:01:30 /usr/local/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 17881 16153 0 20:52 pts/2 00:00:00 more /tmp/zabbix_agentd.log
root 18036 16153 0 20:54 pts/2 00:00:00 grep zabbix
# /etc/init.d/zabbix-agent stop
Shutting down Zabbix agent: [FAILED]
# /etc/init.d/zabbix-agent status
zabbix_agentd is stopped
# ps -ef | grep zabbix
zabbix 4204 1 0 May31 ? 00:09:36 /usr/local/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 4205 1 0 May31 ? 00:03:53 /usr/local/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 4206 1 0 May31 ? 00:03:49 /usr/local/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 4207 1 0 May31 ? 00:03:53 /usr/local/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 4208 1 0 May31 ? 00:01:30 /usr/local/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 17881 16153 0 20:52 pts/2 00:00:00 more /tmp/zabbix_agentd.log
root 18216 16153 0 20:55 pts/2 00:00:00 grep zabbix
# killall -TERM zabbix_agentd
杀掉这些Zabbix Agent进程后,重启Zabbix Agent服务问题解决。结合网上搜索到的相关资料和自己的操作步骤(history查看历史信息)来看,在升级Zabbix前,忘记关闭Zabbix Agent服务(就直接运行rpm -Uvh zabbix-agent-5.0.1-1.el5.x86_64.rpm命令),导致Zabbix的相关进程没法释放。端口被占用,这些进程也无法通过正常的命令关闭。从而出现这个问题。