Ad Widget

Collapse

Including host group in trigger email notifications

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • btrujillo
    Junior Member
    • Jul 2011
    • 4

    #1

    Including host group in trigger email notifications

    Hi folks,

    I'm near completion in configuring Zabbix! I have a question around Actions and was hoping the experts here might have some ideas.

    Currently I've got my Actions (event source is Triggers) configured to send out an email with the following details:
    Server: {HOSTNAME}
    Status: {TRIGGER.STATUS}
    Alert: {TRIGGER.NAME}
    Severity: {TRIGGER.SEVERITY}
    Last value: {ITEM.LASTVALUE}
    Time stamp: {TIME}
    Date: {DATE}

    Is there any way to also include the Host Group to which the triggered host belongs to? I don't see such a definition in the Zabbix manual that is specific to host groups. Ideally it would look something like this:
    Customer: {HOSTGROUP}

    The reason behind this is that we are an IT provider and have grouped our customers using Host Groups. It would be great to know which customer it is we're receiving an alert for. Perhaps there's a better way to accomplish this?

    Thanks!
    Last edited by btrujillo; 13-07-2011, 06:07. Reason: Typos!
  • Davidus
    Senior Member
    • Dec 2010
    • 281

    #2
    My suggestion would be MACROS
    You can define one and use it in your action condition
    See User macros section
    http://www.zabbix.com/documentation/.../config/macros

    Comment

    • btrujillo
      Junior Member
      • Jul 2011
      • 4

      #3
      Davidus, thanks for your response!

      I had looked at macros but could see no way to specify them at the Host Group level. I can see where it can be specified at the Template, Host, Global, etc levels though. Is this what you were suggesting?

      Comment

      • Davidus
        Senior Member
        • Dec 2010
        • 281

        #4
        Yes sir
        Global Macro should do the trick

        Comment

        • btrujillo
          Junior Member
          • Jul 2011
          • 4

          #5
          That did the trick, thanks again!

          Comment

          • Davidus
            Senior Member
            • Dec 2010
            • 281

            #6
            you are welcome

            Comment

            • thmix
              Junior Member
              • Mar 2012
              • 5

              #7
              Could you please explain the steps you used to create the global {HOSTGROUP} macro? This is exactly what I am looking for. Thanks.

              Comment

              • maplesyrupghost
                Member
                • Jul 2012
                • 37

                #8
                +1

                I need global macros for emails! Huge feature lacking, having more than one group just makes things confusing when you get the emails.

                Comment

                • hopetrunks
                  Junior Member
                  • Jun 2013
                  • 8

                  #9
                  This would be very helpfull if someone can explain how to do that.

                  I understand that the {HOSTGROUP.ID} macro cant be used for notification (only for MAP URLs ..) but apparently it's possible to make something for have it in the mail ...

                  Thanks.

                  Comment

                  • hopetrunks
                    Junior Member
                    • Jun 2013
                    • 8

                    #10
                    Nobody know ?

                    Comment

                    • steveboyson
                      Senior Member
                      • Jul 2013
                      • 582

                      #11
                      You have at least two ways for doing that:
                      1.) create a template, link all hosts of your host group to that template
                      and create in that template a macro variable containing the name of your hostgroup.
                      Then you should be able to use this template macro in your alerting/notification texts.

                      2.) use external alerting/notification and get the hostgroup's name via SQL:

                      MySQL:
                      select g.name from groups g, hosts h, hosts_groups hg where g.groupid = hg.groupid and h.hostid = hg.hostid and h.host like "YOUR_HOST_NAME";

                      Take care as a host can be member of more than one hostgroups.

                      Comment

                      • Starko
                        Member
                        Zabbix Certified SpecialistZabbix Certified Professional
                        • Aug 2012
                        • 93

                        #12
                        {TRIGGER.HOSTGROUP.NAME}

                        Comment

                        • Cynchie
                          Junior Member
                          • Jun 2019
                          • 9

                          #13
                          Thanks Starko! This worked for me!

                          Comment

                          Working...