1

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
  • 2,354
  • 1
  • 13
  • 18
sysfiend
  • 1,387
  • 1
  • 12
  • 24
  • @Richlv imported from xml but they cannot be pre-linked to the template, it throws an error about `template x` not existing and in fact it does exist. – sysfiend Jun 07 '16 at 12:54

1 Answers1

3

It depends on how the way hosts are added.

  1. 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;
  2. 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.

Richlv
  • 2,354
  • 1
  • 13
  • 18