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

doublequoted user macro value parsing from script item parameter failing

    XMLWordPrintable

Details

    • Problem report
    • Status: Confirmed
    • Trivial
    • Resolution: Unresolved
    • 5.4.3
    • None
    • Server (S)
    • None

    Description

      Steps to reproduce:

      1. Create Script item type with some parameter having value e.g. {$TEST_MACRO} and code e.g.:
        var script_params = JSON.parse(value);
        return JSON.stringify(script_params);
        
      2. Fill user macro {$TEST_MACRO} with doublequoted value, e.g. "SUBMITTED", or "SUBMITTED","REPEATED", and so on.
      3. Initiate item execution and see it in latest data.

      Result:

      Cannot execute script: SyntaxError: invalid json (at offset 17)
      at [anon] (duktape.c:34562) internal
      at parse () native strict preventsyield
      at [anon] (function:1) preventsyield
      

      Expected:
      The same as when doublequoted value in script parameter directly (not via user macro), but directly it is working without error, e.g.:

      {"test_param":"\"SUBMITTED\",\"REPEATED\",\"SCHEDULED\",\"ALLOCATED\",\"STARTED\""}

      I haven't found in documentation https://www.zabbix.com/documentation/current/manual/config/items/itemtypes/script that these two cases should have different parameter parsing / escaping ...

      Attachments

        Activity

          People

            zabbix.dev Zabbix Development Team
            rico Richard Ostrochovský
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: