Ad Widget

Collapse

How can I add my BU tag to the Message template sent out in emails.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NE1Scott
    Member
    • Jan 2021
    • 49

    #1

    How can I add my BU tag to the Message template sent out in emails.

    How can I add my BU tag to the Message template sent out in emails.

    My Zabbix manages about 7 BU's with multiple sites. We added a BU tag to each to be able to tell what site it is at.

    When I get a notification email from Zabbix I can get an idea of who owns the machine based on the email group it sent the alert to, but some of me BU's have 3 - 5 sites each.

    I Currently have this config in Message templates for the "problem" email alert :
    • Message type Problem
    • Subject Problem: {EVENT.NAME}
    • Message Problem started at {EVENT.TIME} on {EVENT.DATE}
      Problem name: {EVENT.NAME}
      Host: {HOST.NAME}
      Severity: {EVENT.SEVERITY}
      Operational data: {EVENT.OPDATA}
      Original problem ID: {EVENT.ID}
      {TRIGGER.URL}
    What would I need to add to get it to display the BU tag as well so that i have all the info I need in this email.(IP address would be nice as well as host group)

    zabbix-web-deps-scl-5.0.22-1.el7.noarch
    zabbix-server-mysql-5.0.22-1.el7.x86_64
    zabbix-apache-conf-scl-5.0.22-1.el7.noarch
    zabbix-web-5.0.22-1.el7.noarch
    zabbix-get-5.0.22-1.el7.x86_64
    zabbix-web-mysql-scl-5.0.22-1.el7.noarch
    zabbix-agent-5.0.22-1.el7.x86_64
    zabbix-release-5.0-1.el7.noarch
    Last edited by NE1Scott; 13-05-2022, 03:07.
  • NE1Scott
    Member
    • Jan 2021
    • 49

    #2
    After googling message templates and examples while trying to find a list of valid things i could add to the list, I have added a few lines to the "problem" template that might work or might blow up.

    IP Address: (HOST.IP)
    Host Group: (HOST.GROUP)
    Business Unit (TAG:BU)

    Fingers crossed but have low hopes for the bottom one.

    Comment

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

      #3
      I think that should be
      Business Unit: {EVENT.TAGS.BU}

      Comment

      • NE1Scott
        Member
        • Jan 2021
        • 49

        #4
        i will give that a try. All 3 lines I added yesterday made it into my alert emails but NONE of them populated with any data
        Any idea what is needed to give them actual data ?
        I just picked those values because I saw them used on a webpage I googled but I have done nothing on my side to map them. I was hoping they were built-ins.
        XDASMS_Errors <[email protected]>
        2022-05-13 10:42
        to XDASMS.errors

        Problem started at 15:42:51 on 2022.05.13
        Problem name: Critical memory utilization ( >95% for 30s)
        Host: Prod_XASIS_UK2-OXA-CVS1AKS
        Severity: High
        Operational data: 95.12 %
        Original problem ID: 69142314
        IP Address: (HOST.IP)
        Host Group: (HOST.GROUP)
        Business Unit (TAG:BU)

        Comment

        • NE1Scott
          Member
          • Jan 2021
          • 49

          #5
          Good news, 2 out of 3 are now working.

          I noticed with a magnifying glass that they were using curly brackets instead of parentheses so I changed them.
          I changed the Business Unit line as you suggested and it works now.
          IP Address: {HOST.IP}
          Host Group: {HOST.GROUP}
          Business Unit: {EVENT.TAGS.BU}

          Unfortunately, Host Group: {HOST.GROUP} is NOT WORKING.
          I will try EVENT.GROUP but I don't think that is right either.

          Comment

          • NE1Scott
            Member
            • Jan 2021
            • 49

            #6
            Setting it as :
            Host Group: {HOST.GROUP} .....................................shows Host Group: {HOST.GROUP} in the email.
            Host Group: {HOST.GROUPID} ..................................shows Host Group: {HOST.GROUPID} in the email.
            Host Group: {HOST.HOST GROUP} ...........................shows Host Group: {HOST.HOST GROUP} in the email.

            So obviously unless i GUESS the right variable name it just shows my failed variable verbatim.

            Where can I get a list of valid variable names ? Zabbix documentation isn't showing them and random googling has gotten me a few to try that helped get IP and BU working, but nothing hostgroup related is working yet.
            Last edited by NE1Scott; 14-05-2022, 18:26.

            Comment

            • Markku
              Senior Member
              Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
              • Sep 2018
              • 1782

              #7


              Markku

              Comment

              • NE1Scott
                Member
                • Jan 2021
                • 49

                #8
                Well I have found this page and have high hopes now for {HOSTGROUP.ID} which I am trying.

                https://www.zabbix.com/documentation...ed_by_location
                (/documentation/current/en/manual/appendix/macros/supported_by_location)

                I don't know why previous searches and combing the documentation did not find this before but a lucky google hit might have provided everything I need to fully customize the Alert messages.
                Last edited by NE1Scott; 14-05-2022, 18:23.

                Comment

                • NE1Scott
                  Member
                  • Jan 2021
                  • 49

                  #9
                  Originally posted by Markku
                  I just saw your post and it was for the site I stumbled upon.

                  I appreciate the response as was very good info, but my hostgroup issue persists.

                  Instead of resolving the variable {HOSTGROUP.ID} it changes it to a link {HOSTGROUP.ID} (blue and underlined) pointing to "http://hostgroup.id" in the email when I use it as the document listed as valid.
                  Is this a BUG ?
                  Last edited by NE1Scott; 14-05-2022, 18:57.

                  Comment

                  • Markku
                    Senior Member
                    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
                    • Sep 2018
                    • 1782

                    #10
                    {HOSTGROUP.ID} → Map element labels, map URL names and values Host group ID.
                    It doesn't say that the macro is usable in any action message. It is probably your email software that thinks hostgroup.id is a hostname and makes it an http URL.

                    Markku

                    Comment

                    • NE1Scott
                      Member
                      • Jan 2021
                      • 49

                      #11
                      It is just using CentOS7 default sendmail program as far as I can tell unless Zabbix has it's own email server built-in.

                      From an email address
                      [email protected]>

                      To a business gmail account @companyname.com

                      I agree it may be displaying as a link due to the sendmail or sender/recipient platforms, but it is only doing this because it is not resolving as the groupname.

                      Do you have anything else I can try for the host group name in this case ? (I threw 3 or 4 more variants in to see what they produce...but waiting for the first alert email to see if they are any better or worse)

                      Comment

                      • Markku
                        Senior Member
                        Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
                        • Sep 2018
                        • 1782

                        #12
                        {TRIGGER.HOSTGROUP.NAME} → Trigger-based notifications and commands
                        → Problem update notifications and commands
                        → Trigger-based internal notifications
                        → Manual event action scripts
                        A sorted (by SQL query), comma-space separated list of host groups in which the trigger is defined.
                        No other idea

                        Markku

                        Comment

                        • NE1Scott
                          Member
                          • Jan 2021
                          • 49

                          #13
                          IP Address: {HOST.IP}
                          Host Group: {TRIGGER.HOSTGROUP.NAME}
                          Business Unit: {EVENT.TAGS.BU}

                          Adding these 3 parameters got all 3 lines working. I've been gone the last 8 hours but just checked back and this is the combo that worked.

                          Thanks for all of your help !!

                          Comment

                          Working...