Zabbix远程命令执行失败
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Zabbix远程命令执行失败相关的知识,希望对你有一定的参考价值。
前言
问题 : 手机上收到tomcat server【80】 down信息,服务down掉,往往都是有重启操作。重启失败才会报警。如果重启操作执行了,我们就需要查看为何不能启动?
Trigger: Tomcat service【80】is down
Trigger status: PROBLEM
Trigger severity: Disaster
Trigger URL:
Item values:
1. Tomcat status (192.168.96.200:net.tcp.listen[80]): 0
2. *UNKNOWN* (*UNKNOWN*:*UNKNOWN*): *UNKNOWN*
3. *UNKNOWN* (*UNKNOWN*:*UNKNOWN*): *UNKNOWN*
Original event
主机说明:
192.168.96.113: zabbix server
192.168.96.115: zabbix proxy 用于监控主机
192.168.96.200: 被监控的主机
1. 先查看重启动作是否执行。
服务down掉,往往都是有重启操作。重启失败才会报警。如果重启操作执行了,我们就需要查看为何不能启动?首先确保重启操作是否实行成功。登录zabbix web端查看动作的执行,【报表】--> 【动作日志】如下图:
如图,可以看到此命令执行失败,并且提示可能是访问拒绝。我们需要进一步确认出错是否为访问问题。
2. 查看执行命令主机日志
登录192.168.96.200,并查看其zabbix agent端日志。
[[email protected] ~]# tail -5 /var/log/zabbix/zabbix_agentd.log
2325:20170906:192653.587 active check configuration update from [192.168.96.115:10051] started to fail (cannot connect to [[192.168.96.115]:10051]: [4] Interrupted system call)
2325:20170906:192753.599 active check configuration update from [192.168.96.115:10051] is working again
2322:20170906:192754.512 failed to accept an incoming connection: connection from "192.168.96.113" rejected, allowed hosts: "192.168.96.115"
2324:20170906:155824.924 failed to accept an incoming connection: connection from "192.168.96.113" rejected, allowed hosts: "192.168.96.115"
2323:20170906:160824.587 failed to accept an incoming connection: connection from "192.168.96.113" rejected, allowed hosts: "192.168.96.115"
从日志中我们可以知道,zabbix server 192.168.96.113 试图与 192.168.96.200建立连接,192.168.96.200拒绝连接,因为他只能允许192.168.96.115。
3. 解决问题
192.168.96.113用代理服务器192.168.96.115采集数据,而远程命令是无法交由proxy执行(zabbix server 和zabbix proxy 支持的文件看附录一)。
grep ^[A-Z] /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
EnableRemoteCommands=1
LogRemoteCommands=1
Server=192.168.96.115
ServerActive=192.168.96.115
Hostname=192.168.96.200
Include=/etc/zabbix/zabbix_agentd.d/
可以看到server仅为192.168.96.115,故192.168.96.113无法执行远程命令。我们需要将server=10.60.96.115修改为server=10.60.96.113,10.60.96.115。
注意 : zabbix agent 配置文件修改需要重启服务,
centos 6上: ~]# service zabbix-agent start
centos 7 上:~]# systemctl start zabbix-agent
编译安装:请找到安装目录下的sbin目录,并运行zabbix_agentd命令。
附录一:
Function | Supported by proxy |
---|---|
Zabbix agent checks | Yes |
Zabbix agent checks (active) | Yes |
Simple checks | Yes |
Trapper items | Yes |
SNMP checks | Yes |
SNMP traps | Yes |
IPMI checks | Yes |
JMX checks | Yes |
Log file monitoring | Yes |
Internal checks | Yes |
SSH checks | Yes |
Telnet checks | Yes |
External checks | Yes |
Built-in web monitoring | Yes |
Network discovery | Yes |
Low-level discovery | Yes |
Calculating triggers | No |
Processing events | No |
Sending alerts | No |
Remote commands * | No |
以上是关于Zabbix远程命令执行失败的主要内容,如果未能解决你的问题,请参考以下文章