Ad Widget

Collapse

Zabbix 6.4 : cannot assign tags to hosts through templates.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Corsi
    Junior Member
    • Sep 2023
    • 2

    #1

    Zabbix 6.4 : cannot assign tags to hosts through templates.

    I created several templates with the purpose of assigning the same tags to a set of hosts.
    For example, I have a tempalte "Tag_Production_Server". In this template, I defined a "Environment" tag with value "Production".

    I assigned this template to several hosts.

    When I look at these host details, I do not see the "Environment" tag.
    When I look at these host items and triggers, I do not see the "Environment" tag neither, even in inherited zone.

    When a problem occurs with one of these triggers, it does not bear the "Evenrionemnt" tag.

    The subsequent actions are thus not working (sending alerts, custom dashboard and services...).

    Have I missed something ?

    How can I apply these tags properly ?




  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Originally posted by Corsi
    I created several templates with the purpose of assigning the same tags to a set of hosts.
    For example, I have a tempalte "Tag_Production_Server". In this template, I defined a "Environment" tag with value "Production".

    I assigned this template to several hosts.

    When I look at these host details, I do not see the "Environment" tag.
    When I look at these host items and triggers, I do not see the "Environment" tag neither, even in inherited zone.

    When a problem occurs with one of these triggers, it does not bear the "Evenrionemnt" tag.

    The subsequent actions are thus not working (sending alerts, custom dashboard and services...).

    Have I missed something ?

    How can I apply these tags properly ?
    Those items and triggers, they come from different template? If your "tag template" only contains tags and is not linked to any other template, then these tags will not transfer to items/triggers coming from different templates...
    You should only see that environment tag in your host details as inherited macro... But it will not transfer to anything ...

    If you link your "items" template to your "tags" template and then add that tags template to host, it will automatically bring all the items with it and all your items will inherit tags from "higher level "tags"" template...

    Comment

    • Corsi
      Junior Member
      • Sep 2023
      • 2

      #3
      Thank you for your reply.

      Some of these items and triggers have been created directly on the host, others are indeed coming from other templates.

      But none of them are showing for example this "Environmentroduction".

      The host itself doesn't show that tag either.


      I can't put these tags in the "items tempalte", for example :

      Many items come from the "Windows by Zabbix agent active" template. And I only one to categorize some of them as "production".

      Furthermore, I also have a custom tag telling which business application is related to a given host.


      My need is to define for example that all alerts from :
      • Host1 are Environment:Production and Business:Legal
      • Host 2 are Environment:Production and Business:Billing
      • Host 3 are Environment:Test and Business:Legal
      All items defined on these host coming from the same base template.

      I thus understand from your answer that I can't do that through tags ?
      Is the only way to do so to apply these tags directly to concerned hosts without using templates ?


      Thanks again for your help !

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        items/triggers directly on host do not inherit tags from templates... it will work the other way around.. Exactly as docs say...

        https://www.zabbix.com/documentation...config/tagging
        • with tagged templates - any host problems created by relevant entities (items, triggers, etc) from this template will be marked
        • with tagged hosts - any problem of the host will be marked
        • with tagged items, web scenarios - any data/problem of this item or web scenario will be marked
        • with tagged triggers - any problem of this trigger will be marked

        A problem event inherits all tags from the whole chain of templates, hosts, items, web scenarios, triggers.
        So for you to work with tags, you should add those tags on host level, not through templates...
        Or you have one "host macros" template per host, which you link to your base template (and any other template).. then link that one macro template to host and it will bring all the base items with it, but as macro template is higher in hierarchy, base items will inherit tags from it... But with many hosts, its pretty badly maintainable system (or even unmaintainable) .... It would be easier to tag hosts during registration somehow.​

        Comment

        Working...