Zabbix API templage.get selectMacros - doesn't work in limiting output

XMLWordPrintable

    • Type: Incident report
    • Resolution: Won't fix
    • Priority: Trivial
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Steps to reproduce:

      1. I need to filter Zabbix API Query result to return ONLY One concrete macro.
      2. From API documentation it looks like that would be possible by using selectMacro propery or Search filter.
      3. No matter what I've tried 100-500 different attempts, selectMacros always returns either ALL macros in Template or Empty Macros array.
      4. The Query:
      5. curl --insecure -i -X POST -H 'Content-Type: application/json-rpc' -d '{"jsonrpc":"2.0","method":"template.get","params":{"search":{"host":"Test Zabbix Api selectMacros Template","macro":"{$MACRO3}"},"output":["hostmacroid","macro","value"],"selectMacros":"extend"},"auth":"myId","id":1}' https://<IP>/api_jsonrpc.php
        

        This returns ALL Macros, but that is not desired output:

      6. {"jsonrpc":"2.0","result":[{"templateid":"10578","macros":[{"hostmacroid":"1857","hostid":"10578","macro":"{$MACRO1}","value":"Value1"},{"hostmacroid":"1858","hostid":"10578","macro":"{$MACRO2}","value":"Value2"},{"hostmacroid":"1859","hostid":"10578","macro":"{$MACRO3}","value":"Value3"}]}],"id":1}
        

       

      1. "limit":1 - also doesn't work in any JSON request block.
      2. "selectMacros":["1859"] - doesn't work. This always returns empty array.
      3. {"jsonrpc":"2.0","result":[{"templateid":"10578","macros":[[],[],[]]}],"id":1}
        

        I don't want to keep all the macros in the buffer. Because there may be passwords in other Macros. Is it so that Zabbix API filtering for macros doesn't work ? a bug ?

      "selectMacros":"1859" - doesn't work, this returns an empty array like this:

      {"jsonrpc":"2.0","result":[{"templateid":"10578","macros":[]}],"id":1}
      

      Result:
      See screenshot...
      See log file...
      See memory dump...
      Expected:
      See screenshot....
      See attached patch file...

            Assignee:
            Zabbix Support Team
            Reporter:
            Vadims Kurmis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: