Ad Widget

Collapse

Updating macro from JSON Response

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gordonlittle
    Junior Member
    • Apr 2020
    • 1

    #1

    Updating macro from JSON Response

    I've created an HTTP Agent item named "error_result" which calls a web service. The service supports a form of paging where it takes a query parameter indicating the last timestamp to search from. The latest timestamp found in the last search is returned in the JSON response. (So the idea is you supply the last value returned into the next query to ensure you only get new results returned). Initially I've set the query parameter to zero in a user macro called LATEST.

    I also have a Dependent Item named "error_result_latest" which pre-processes the json response from error_result to extract the timestamp of the latest record found.

    So, I call the web service with URL https://server-name/path/to/service

    query param is "latest" : {$LATEST}

    This works once, returns the json for an error result and error_result_latest records the latest timestamp found.

    My requirement is then to pass the value in error_result_latest as the query parameter in subsequent calls to the web service.

    Can I use the last value of an item in another item, or can I update my {$LATEST} user macro with the error_result_laest value?

    I hope that makes sense. I suspect I may need to wait for https://support.zabbix.com/browse/ZBXNEXT-4449 but want to check I'm not missing anything else.

    Thanks in advance.
Working...