问题原文
原帖链接 · sysfiend · CC BY-SA 3.0
So I have some custom templates on my zabbix that I would like to assign to every new host as soon as it gets added, does anyone know if that's possible?
So far, from testing and reading from the zabbix forums, my answer is no but would like to be sure before getting into work with the API again.
已采纳解答
原帖链接 · Richlv · CC BY-SA 3.0
It depends on how the way hosts are added.
- if the hosts are added via the network discovery or active agent auto-registration, the same actions that add the hosts can also link them to templates;
- if the hosts are added manually or via the API, you would indeed have to use the host.update API method
Based on your comment, the hosts are imported from XML, and specifying the template in the XML doesn't work. That is a separate problem, though - you should doublecheck that the template technical name (not visible name) matches exactly (it is case sensitive). Also make sure the user importing the XML is superadmin, otherwise permissions can make everything much more tricky.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
