Zabbix: What is the difference between `HostMetadata` and `HostMetadataItem`?

Question = headline ;-)

Official docs here. I've read this example too, but still don't have a clue.

Additional question: How can I specify multiple meta items? E.g. env=staging,server=db.

I would like to chose a template automatically after a client auto registers.

An additional example showing the differences would be awesome!


HostMetadataItem is an item key that will be evaluated and the result sent as HostMetadata, for example, system.uname

HostMetadata is just user defined string. Write there, what do you need. Example of Zabbix agent HostMetadataItem setting:

HostMetadata=:osname=Linux:env=staging:color=blue:docker=yes:app=apache:

Example Zabbix autoregistration with condition&operation for HostMetadataItem example above:

  • Condition: Host metadata like :osname=Linux:; Operation: Link to templates: Template OS Linux
  • Condition: Host metadata like :docker=yes:; Operation: Link to templates: Template App Docker
  • Condition: Host metadata like :app=apache:; Operation: Link to templates: Template App Apache
  • Condition: Host metadata like :env=staging:; Operation: Add to host groups: Staging servers
  • Condition: Host metadata like :color=blue:; Operation: Add to host groups: Blue servers
  • ...

If your autoregistration rules are complete, then you can delete your hosts from the Zabbix UI anytime. They will be autoregistered back in a few minutes with the right templates/group.