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

User macro expanded with escaping double quotes in HTTP agent item.

    XMLWordPrintable

Details

    • Team B
    • Sprint 74 (Mar 2021), Sprint 75 (Apr 2021), Sprint 76 (May 2021), Sprint 77 (Jun 2021), Sprint 78 (Jul 2021), Sprint 79 (Aug 2021), Sprint 80 (Sep 2021)
    • 0.5

    Description

      HTTP agent item pointing at Zabbix API.
      Request type: POST
      Request body type: JSON data
      Request body:

      {"jsonrpc":"2.0","method":"user.login","params":{"user":"Admin","password":"zabbix"},"id":1,"auth":null}
      

      This works as expected. From debug log:

      {"jsonrpc":"2.0","method":"user.login","params":{"user":"Admin","password":"zabbix"},"id":1,"auth":null}
      

      But if the request body is replaced with user macro {$MACRO} with the exact same contents, TEST from the frontend works, but when done by Zabbix itself it does not:

      15927:20210313:174104.187 In get_value_http() request method 'POST' URL 'http://localhost/zabbix/api_jsonrpc.php' headers '' message body '{\"jsonrpc\":\"2.0\",\"method\":\"user.login\",\"params\":{\"user\":\"Admi
      n\",\"password\":\"zabbix\"},\"id\":1,\"auth\":null}'
      

      Zabbix has added "\" symbols in front of each double quote, trying to escape those.
      And the result is no longer successful login, but failure:

      {"jsonrpc":"2.0","error":{"code":-32700,"message":"Parse error","data":"Invalid JSON. An error occurred on the server while parsing the JSON text."},"id":null}
      

      Why is Zabbix escaping double quotes only if expanding from macro?
      If this is how it's supposed to work, the test option should work the same way.

      Attachments

        Activity

          People

            iivs Ivo Kurzemnieks
            zux Edgars Melveris
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: