Ad Widget

Collapse

How to address host TAGS in email messages ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pigi_102
    Member
    • Sep 2021
    • 35

    #1

    How to address host TAGS in email messages ?

    Hello all,
    first post here so please apologize for every error.
    I'm using Zabbix 5.4 and have the following configuration:
    HOST which is linked to a TEMPLATE.
    In the TEMPLATE I have a couple of TAGS: CATEGORY and GROUP

    I can use this tags in searches ( for example ), but I can't find a way to add those tags in the email that are sent when an event (Critical,Warning,Recovery ) occurs.

    For the emails I have a message template with a bunch of macro eg. { HOST.NAME } { EVENT.NAME } and so on but I'm not sure how can I use my tags.

    Neither I can find something in documentation or even in this forum.

    It should be something like { HOST.TAGS.CATEGORY } but I'm not sure about this.


    Is there someone that can share a bit more info on this ?

    Thanks in advance

    Pigi_102
    Last edited by Pigi_102; 17-09-2021, 21:26.
  • Pigi_102
    Member
    • Sep 2021
    • 35

    #2
    Just to make it clear, I have the following:

    Click image for larger version  Name:	SkiPag4.jpg Views:	0 Size:	23.4 KB ID:	431758

    In the host configuration I have this tag:
    Click image for larger version  Name:	SkiPag5.jpg Views:	0 Size:	40.3 KB ID:	431763

    This are the linked templates:
    Click image for larger version  Name:	SkiPag6.jpg Views:	0 Size:	53.1 KB ID:	431764

    and this are the tags in the linked template:
    Click image for larger version  Name:	SkiPag7.jpg Views:	1 Size:	44.0 KB ID:	431761

    I would like to have som ( or all ) of this tags in the mails I send for problems or error.

    Thanks in advance


    Pigi_102
    Last edited by Pigi_102; 18-09-2021, 12:33.

    Comment

    • Pigi_102
      Member
      • Sep 2021
      • 35

      #3
      Hello Cybr, and thanks for your reply.
      So, If I understand correctly, HOST or TEMPLATE TAGS becomes EVENT TAGS in case of an event ?
      I will do a very quick test tonight, but that's a really interesting point of view.
      I had not understood that !

      Thanks again

      Pierluigi

      Comment

      • Pigi_102
        Member
        • Sep 2021
        • 35

        #4
        Hello Cyber !
        Your suggestion kinda works.
        I say kinda as I can get the TAGS from HOST ( I mean the "CATEG" from the images in first post ) but not those from templates.
        I've also tried to get a list of tags with the
        Code:
        {EVENT.TAGS}
        as suggested by you, but still get only the one from HOST.
        Those from the linked templates still don't appears in email.

        This is ( part of the ) the content from my template in "media type"
        Code:
        {EVENT.TAGS}
        1 {EVENT.TAGS.CATEGORY}
        2 {EVENT.TAGS.GROUP}
        3 {EVENT.TAGS.CATEG}
        and this is the mail:
        Code:
        CATEG:myc
        {EVENT.TAGS.CATEGORY}
        1 {EVENT.TAGS.CATEGORY}
        2 {EVENT.TAGS.GROUP}
        3 myc
        ( Just to avoid looking back, CATEG is the one in HOST, CATEGORY and GROUP are in one of the two linked templates. )

        They all appears in HOST list, but can't find a way to ue them in mail messages.

        Maybe they are not usable ?

        Thanks

        Pigi_102

        Comment

        • Pigi_102
          Member
          • Sep 2021
          • 35

          #5
          Hard to say, Cyber, as I'm new on this world ( zabbix ) and far from home now.
          Is the default trigger for the zabbix server that get created when you first install the environment.
          I will give a look this afternoon when I'm home.

          I really appreciated your help.


          Pigi_102

          Comment

          • Pigi_102
            Member
            • Sep 2021
            • 35

            #6
            Cyber, as far as I can understand the trigger that get triggered is from host.
            Basically what I do to get the email is to shut down an interface so I get the mssage "Interfae wlan0 down " and the TAGS are those present in HOST.
            I will try to trigger an alarm from the template, but I must say my hope was to get all the TAGS from wherever they are configured to be "usable" in mails .

            I'll let you ( and everyone interessed ) know what are the results.

            Thanks again

            Comment

            • Pigi_102
              Member
              • Sep 2021
              • 35

              #7
              Cyber, you THE man.
              I've added a tag to a linked template, and triggered an event that is part of this template.
              In the email I got there are the tags from this template and the tags from the host, but not the tags from the other linked template.

              So if you ( me ) want the tags in you email you have to have them in the "object" that triggers the event.

              Thanks a lot, Cyber as I wouldn't have found this without your help.

              Pigi_102

              Comment

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

                #8

                {EVENT.TAGS} → Trigger-based notifications and commands
                → Problem update notifications and commands
                → Manual event action
                A comma separated list of event tags. Expanded to an empty string if no tags exist.
                Supported since 3.2.0.
                {EVENT.TAGS.} → Trigger-based notifications and commands
                → Problem update notifications and commands
                → Problem and event URLs
                → Manual event action
                Event tag value referenced by the tag name.
                A tag name containing non-alphanumeric characters (including non-English multibyte-UTF characters) should be double quoted. Quotes and backslashes inside a quoted tag name must be escaped with a backslash.
                Supported since 4.4.2.

                Comment

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

                  #9
                  Yes.. All possible tags are applied to event, they can be inherited from trigger or template or host level. Latest versions add items also to this list.

                  ...

                  Comment

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

                    #10
                    Works here with 4.4 ... we are feeding both ways to our action... {EVENT.TAGS} and also some of them separately {EVENT.TAGS.} in Default message.
                    5.x has it a bit differently but you still have message template where you can use all the same macros for customizing your message.
                    Where is your test trigger? directly on host or in one of those templates? Seems like in email your CATEG tag gets resolved, but others not...

                    Comment

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

                      #11

                      If entities are tagged, the corresponding new events get marked accordingly:
                      • with tagged templates - any host problems created by triggers from this template will be marked
                      • with tagged hosts - any problem of the host will be marked
                      • with tagged items - any data/problem of this item will be marked
                      • with tagged triggers - any problem of this trigger will be marked

                      Comment

                      Working...