Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-8565

New system macro(s) with raw alert message text for mediatype scripts

XMLWordPrintable

    • Icon: New Feature Request New Feature Request
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 6.0.19, 6.4.4, 7.0.0alpha2
    • None
    • None
    • Team INT

      It will be great if we have new one or several system macros with a raw alert message text with not expanded macros.

      This decision will be useful for more flexible development of mediatype scripts.

      There is the Telegram mediatype and the task ZBX-22159 regarding it. Markdown mode doesn't work in this mediatype now. All special symbols in macro values (e.g. {HOST.NAME}, {EVENT.NAME}, etc.) need to be escaped to fix it. But there aren't ways to find inside the script which part of the alert message is the macro value.

      For example, the mediatype text is:

      __Warning__ \{HOST.NAME} has been restarted!
      

      {HOST.NAME} macro value is example_srv#12

      The result text will be:

      __Warning__ example_srv#12 has been restarted!
      

      Telegram will return an error because of special symbols in hostname.

      To fix it could be have a one of the following ways:
      1. It could be a single system macro (e.g. {ALERT.MESSAGE.JSON}) with the value like this:

      {
          "message": "__Warning__ \{HOST.NAME} has been restarted!",
          "macros":
          [
              "\{HOST.NAME}": "example_srv#12"
          ]
      }
      

      2. Or several system macros with a raw alert message text and a list of macro values:
      {ALERT.MESSAGE.RAW} = "_Warning_ {HOST.NAME} has been restarted!"
      {ALERT.MACROS.JSON} =

      [
          "\{HOST.NAME}": "example_srv#12"
      ]
      

      And these macro values will be used in the mediatype script for more flexibility of data processing.

            zabbix.dev Zabbix Development Team
            aiantsen Aleksandr Iantsen
            Team INT
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: