[ZBX-17619] User macros not working for HTTP agent request body Created: 2020 Apr 23 Updated: 2025 Mar 20 Resolved: 2020 Apr 29 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 4.0.19 |
Fix Version/s: | None |
Type: | Problem report | Priority: | Trivial |
Reporter: | Shane | Assignee: | Eduards Matuls (Inactive) |
Resolution: | Commercial support required | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Ubuntu 18, Postgres Database |
Attachments: |
![]() ![]() ![]() ![]() ![]() ![]() |
Description |
Steps to reproduce:
Result: The result I get from the endpoint when I use a macro is blank or '{}', suggesting that the JSON data posted is valid, but the "url" value is incorrect and does not match any records in Google Safe Browsing API. If I change my '{$URL}' macro within the JSON body to the exact text I put in my user macro, it works and the responseI get is a match from Google Safe Browsing API. I'll include a screenshot of both the JSON body including the macro, as well as a screenshot of the straight text. I'll also include a screenshot of latest data, which shows where I change it to use the straight text URL and it begins to work. Expected:
I've tried: Finding logs within the Google Safe Browsing URL that show what the request body contains, but I don't think this is possible. I've also tried finding logs of what Zabbix is actually sending, but couldn't find any way to do this either after a lot of searching.
I've tried sending as 'Raw data' as well as 'JSON data' within the item config.
If there is a way to debug this within Zabbix itself, I'd love to get some more info on what it's actually sending in place of the macro placeholder. |
Comments |
Comment by Eduards Matuls (Inactive) [ 2020 Apr 29 ] | ||||||
Hello! Thank you for reporting the issue. Can you please send screenshots of your item configuration and macro defined? Regards, | ||||||
Comment by Shane [ 2020 Apr 29 ] | ||||||
Thanks for replying Eduards, Here's some screenshots: | ||||||
Comment by Eduards Matuls (Inactive) [ 2020 Apr 29 ] | ||||||
Hello! I've tried to reproduce the issue and I could not. I've installed Zabbix 4.0.19 on Ubuntu 18 with postgres DB suport. Used HTTP agent to get information from local API. My JSON is: { "jsonrpc": "2.0", "method": "host.get", "params": { "filter": { "host": "{$TEST_SERVER_NAME}" } }, "auth": "d881de82305ed43ee165bcf1ef2d28fa", "id": 1 } Here I passed filter value as a macro. And it worked correctly for me. Please be advised that this section of the tracker is for bug reports only. The case you have submitted can not be qualified as one, so please reach out to [email protected] Regards,
| ||||||
Comment by Nicolas Urioste [ 2025 Mar 20 ] | ||||||
Better late than never. I'm using Zabbix 7.2 and phased the same issue. What worked for me is to include the macro without the double quotation mark and on the value of the macro include said double quotation mark. In my case I was working with an API (I can't share it do to security concerns) that required a range of time, also on grapql, and the following solved the issue:
So in the body it would look something like this: "variables": { "from": {$TO}, "to": {$FROM} } |