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

Zabbix quoted contextual user macro containing the context of a Zabbix LLD macro function when using quoted regsub not allowed in trigger function parameter

XMLWordPrintable

    • Icon: Documentation task Documentation task
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 5.0 (plan)
    • 4.0.13
    • Frontend (F)
    • None
    • Zabbix 4.0.7
      PostgreSQL 11
    • Team A
    • Sprint 58 (Nov 2019), Sprint 59 (Dec 2019), Sprint 60 (Jan 2020), Sprint 61 (Feb 2020)

      I use contextual macros in trigger expressions all the time which provides flexibility.

      The issue I am finding is when using a contextual user macro with a context including LLD macro + quoted regsub inside an expression it fails syntactically.

      This occurs when using double quotes for the contextual macro and also to surround the regular expression in the macro function example:

      {$USERMACRO:"{

      {#LLDMACRO}.regsub("^(.*)$",\1)}"}

      The documentation states for contextual macros we should use a double quote and the same with the macro functions.

      The issue here is the fact we are doing this both at the same time and the strings are not being interpreted correctly example:

      String1 = {{#LLDMACRO}

      .regsub(

      Between = ^(.*)$

      String2 = ,\1)}

      If we were able to use single quotes as well we would be able to work around it example:

      {$USERMACRO:"{

      {#LLDMACRO}.regsub('^(.*)$',\1)}"}

      OR

      {$USERMACRO:'{{#LLDMACRO}

      .regsub("^(.*)$",\1)}'}

       

            vso Vladislavs Sokurenko
            james.cook000@gmail.com James Cook
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: