Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-14893

Macro in tags are not expanded in API trigger.get

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Major Major
    • None
    • 4.0.0rc1
    • API (A)
    • None
    • Zabbix 4.rc1 on CentOs 7

      Steps to reproduce:

      1. Add macros to trigger prototype "Free disk space is less than 20% on volume {#FSNAME}" from "Template OS Linux" => "Discovery rules" => "Mounted filesystem discovery" => "Trigger prototypes"
      2. MyHost = {HOST.NAME}
      3. FsName = {#FSNAME}
      4. MyInvOs = {INVENTORY.OS}
      5. Make the trigger fire
      6. Prepare a script calling api "trigger.get" with
      {"auth":"xxxxx",
      "jsonrpc":"2.0",
      "method":"trigger.get",
      "params":{
        "monitored":"true",
        "expandDescription":"true",
        "filter":{"value":1},
        "expandComment":"true",
        "expandExpression":"true",
        "selectTags":"extend",
        "expandData":"true"},
      "id"1}

      Result:
      Extract from API result showing macros not expanded.

         "tags" : [
            {
               "value" : "{INVENTORY.OS}",
               "tag" : "MyInvOs"
            },
            {
               "value" : "/boot",
               "tag" : "FsName"
            },
            {
               "value" : "{HOST.NAME}",
               "tag" : "MyHost"
            }

      Expected:
      When using an action or in the frontend gui, tags are expanded but not in the API.

      Here is the content of the EVENT.TAGS from an action:

      MyHost:myhost,MyInvOs:Linux myhost xxxxxxxxx,FsName:/boot

      It is not expanded for all macros from https://www.zabbix.com/documentation/4.0/manual/config/event_correlation/trigger/event_tags section "Macro support".

      Only User Macro and LLD Macro are expanded on my side in API.

            Unassigned Unassigned
            GuiGuiGui GuiGuiGui
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: