Ad Widget

Collapse

How to Globally add hostname into the subject-line of trigger emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kmfreder
    Junior Member
    • Feb 2020
    • 6

    #1

    How to Globally add hostname into the subject-line of trigger emails

    Really enjoying learning about Zabbix. Love the tool.

    I have seen where you can add {HOST.NAME} to a trigger name individually, which then displays the hostname in the email subject line of trigger emails. Is there a way to globally add the hostname to trigger email's subject line for all triggers?

    Thanks!

    Ken
  • gert.derouck
    Member
    • Jan 2020
    • 69

    #2
    Hi, i don't think you can do this globally.
    You can add it to the trigger action though.

    You can add following as 'Default Subject':
    {HOST.NAME} {EVENT.NAME}

    Comment


    • kmfreder
      kmfreder commented
      Editing a comment
      Awesome. the Default Subject was exactly what we were looking for! Thanks!!
  • it.tech
    Junior Member
    • May 2021
    • 28

    #3
    I ran into this thread looking for the advice on how to add a hostname into the subject of an email alert and got confused. Can someone explain how exactly add it to the trigger action.
    I see two tabs here, one is Action and second is Operations. In the Action tab I can only add hosts, groups and other items that don't have anything to do with "Default Subject"
    Under Operations I have the actual email alert configured to send to specific users but again, nothing where I would add the default subject.
    Please advise!

    Comment

    • kmfreder
      Junior Member
      • Feb 2020
      • 6

      #4
      Go to Configuration>Actions>Trigger actions and then click on the operations tab. Once there, under the operations step, click the "Edit" link.

      On the next screen titled "Operation details", you can edit the custom message to include {HOST.NAME} {EVENT.NAME} or {EVENT.NAME} {HOST.NAME} as below.

      Click image for larger version

Name:	Update subject.PNG
Views:	3800
Size:	30.9 KB
ID:	428360


      Hope that helps!

      Comment

      • it.tech
        Junior Member
        • May 2021
        • 28

        #5
        Ok, thanks a lot, I figured it eventually and configured almost exactly as advised.
        The first alert comes as expected, i.e. I see the hostname in the subject, but when it is resolved, it is not there anymore.
        Here's my subject in the first alert: OBR firewall High ICMP ping loss
        Here's the second: Resolved in 1m 0s: Unavailable by ICMP ping

        Comment

        • kmfreder
          Junior Member
          • Feb 2020
          • 6

          #6
          To get the Hostname in the subject line of the Recovery Operation. From the Operations page as below, click on EDIT in the Recovery operations section.

          Then add the hostname parameter there as well. Sorry I should have mentioned that the first time around. "Resolved: {EVENT.RECOVERY.NAME}{HOST.NAME}"

          Click image for larger version

Name:	Recovery.PNG
Views:	3738
Size:	37.6 KB
ID:	428439

          Comment

          • it.tech
            Junior Member
            • May 2021
            • 28

            #7
            I did it and for some reason the recovery email alert doesn't conttain the hostname in the sjubject
            Her's how it looksClick image for larger version

Name:	111.PNG
Views:	3739
Size:	114.4 KB
ID:	428597

            Attached Files

            Comment

            • kmfreder
              Junior Member
              • Feb 2020
              • 6

              #8
              Hmmm. This configuration is working in my 5.4 installation. Maybe someone else has some ideas on how to troubleshoot. Sorry I can't be of further help here but I am not sure where to go from here if that didn't work.

              Comment

              • it.tech
                Junior Member
                • May 2021
                • 28

                #9
                I added a space in line of subject between two variables, like this Resolved: {EVENT.RECOVERY.NAME} {HOST.NAME}
                Will see if it had any affects

                Comment

                • bitmeup
                  Junior Member
                  • Apr 2018
                  • 18

                  #10
                  For those looking for another solution in 2022 (for zabbix 6.0-6.2), you can just add {HOST.NAME} to the Media Type you are using (e.g Configuration > Media Types > Email (HTML) > Message Templates > Edit each one)

                  Comment

                  • JTSmith
                    Junior Member
                    • Nov 2023
                    • 1

                    #11
                    My thanks to those who posted their solutions. Paying this forward by updating for 2023 (version ~6.4).
                    1. Navigate to Alerts > Media types
                    2. Click the target profile (e.g. Gmail)
                    3. Open the Message template tab
                    4. For each Message type:
                      1. Click Edit
                      2. Add the text {HOST.NAME} to the Subject field, e.g. "[{HOST.NAME}] Problem: {EVENT.NAME}"
                      3. Click Update to close the editor
                    5. Click Update to save changes

                    Comment

                    Working...