[ZBXNEXT-5499] Support for MACROS within JSONPath Created: 2019 Oct 10  Updated: 2023 Sep 29

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Change Request Priority: Trivial
Reporter: Václav Nováček Assignee: Unassigned
Resolution: Unresolved Votes: 23
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Content_of_HOST.NAME.png     PNG File HOST.NAME.png     PNG File Host_macros.png     PNG File NOT_working_zabbix_macro.png     PNG File Working_user_macro.png     Text File json_path_zabbix_ticket.txt     XML File zbx_export_hosts.xml    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-5783 Allow preprocessing to access macros ... Closed
is duplicated by ZBX-20553 JSONpath user macro evaluation Closed

 Description   

Support for such of notation using item preprocessing would be great...

$.['{ITEM.NAME}']

Thanks in advance!



 Comments   
Comment by Tomáš Heřmánek [ 2020 Sep 16 ]

Hi,

for simulation of this problem create example json data (json_path_zabbix_ticket.txt) and upload it on public url. In my example url is: https://www.coreit.cz/download/json_path_zabbix_ticket.txt

after that create a new host (exported with items in attachment zbx_export_hosts.xml). And create a user macro with hostname.

{$USER.MACRO} = 2a2820715eef44c1933002889f5836ac

Create several test http items, without json path, with direct written json path, user macros json path and json path with {HOST.NAME}.

3 items work fine but item with zabbix macros {HOST.NAME}  fails with this error:

Preprocessing failed for: [..{..."inactive": false,..."storeNumber": 4008,..."storeShortNumber": "008",..."storeShortName":...
1. Failed: cannot extract value from json by path "$[?(@.deviceId == "{HOST.NAME}")]": no data matches the specified path

Do you need any additional information?

 

Thanks,

Tom

 

Comment by Richard Ostrochovský [ 2021 Aug 31 ]

If this would be implemented sometimes, also support for user macro contexts would be helpful . Hi Tom, thanks for excellent webinars .

Comment by Yuriy [ 2022 Mar 30 ]

Up!

Comment by Konstantins Prutkovs (Inactive) [ 2023 Sep 29 ]

There is a new workaround for this issue in Zabbix 7.0alpha5, with the merger of feature ZBXNEXT-8638 it became possible to create calculated items and triggers with jsonpath and xmlxpath functions that can have macro in the parameters.

Generated at Wed Jan 22 03:33:13 EET 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.