The Zabbix server log will appear with the following error:
2389:20160223:113026.665 cannot send list of active checks to [10.0.5.10]: host [Windows host] not found
This problem occurs because the hostname shown in dashboard is the client IP address, and the hostname in the Zabbix client configuration file is the default Windows host. We solve this problem by calling Python through Ansible:
The Python code is as follows:
#!/usr/bin/pythonimport osimport timeimport socketimport fileinputos.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 ')
Batch modification via ansible:
Ansible win-m script-a "/root/windows/zabbix_hostname.py"
This article is from the "11062687" blog, please be sure to keep this source http://11072687.blog.51cto.com/11062687/1744224
17. Resolve Zabbix host [Windows host] not found