标签:zabbix
zabbix的服务器日志会出现如下报错:
2389:20160223:113026.665 cannot send list of active checks to [10.0.5.10]: host [Windows host] not found
出现这个问题的原因是因为dashboard中显示的hostname为客户端ip地址,而zabbix客户端配置文件中的Hostname还是默认的“Windows host”,我们通过ansible调用python解决这个问题:
python代码如下:
#!/usr/bin/python import os import time import socket import fileinput os.system(‘sc stop "Zabbix Agent"‘) time.sleep(10) hostname = socket.gethostbyname(socket.gethostname()) for line in fileinput.input("C:\zabbix_agents_2.2.9.win\conf\zabbix_agentd.win.conf", inplace=1): line = line.replace("Hostname=Windows host", "Hostname=%s" % (hostname)) print line, os.system(‘sc start "Zabbix Agent"‘)
通过ansible进行批量修改:
ansible win -m script -a "/root/windows/zabbix_hostname.py"
本文出自 “11062687” 博客,请务必保留此出处http://11072687.blog.51cto.com/11062687/1744224
17.解决zabbix host [Windows host] not found
标签:zabbix
原文地址:http://11072687.blog.51cto.com/11062687/1744224