[ZBXNEXT-4163] Using LLD macros on item preprocessing Created: 2017 Oct 06  Updated: 2024 Apr 10  Resolved: 2018 May 29

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F), Server (S)
Affects Version/s: 3.4.2
Fix Version/s: 4.0.0alpha7, 4.0 (plan)

Type: New Feature Request Priority: Minor
Reporter: Dmitri Assignee: Michael Veksler
Resolution: Fixed Votes: 14
Labels: items, macros, preprocessing
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBXNEXT-4109 Allow to use LLD MACRO value as a val... Closed
is duplicated by ZBX-13167 LLD macros not expanded when creating... Closed
is duplicated by ZBX-13795 Dependent Item Preprocessing: works o... Closed
Sub-task
depends on ZBX-14340 Does not perform validation of numeri... Closed
part of ZBXNEXT-4865 Prometheus format native support Closed
Team: Team C
Sprint: Sprint 32, Sprint 33, Sprint 34, Sprint 35
Story Points: 2.5

 Description   

Is there any possibility of using LLD MACROS in item preprocessing.
For example process JSON based on LLD result:

like:

[JSON Path]
 
$.data[?(@.CHECKNAME == '{#CHECKNAME}' )].value 


 Comments   
Comment by Glebs Ivanovskis (Inactive) [ 2017 Oct 12 ]

This looks like a mix of ZBXNEXT-4087, ZBXNEXT-4109 and request for advanced JSON path syntax which is not provided by ZBXNEXT-3863.

Comment by Holger Gruber [ 2017 Nov 19 ]

Another example where this would be very helpful:
a dependent item prototype where the masterkey (which should not necessarily be an item prototype itself ZBXNEXT-4200) delivers a csv list:

# type,n1,n2,n3,n4
a,0,0,1,0
b,0,0,2,0
c,1,0,1,0

The LLD macro {#TYPE} with values ['a','b','c'] and for item {#TYPE} n3 we would have a preprocessing like this:

Regular expression; ^{#TYPE}([^,]*,){3}([^,]*).*; \2
Comment by David Mitchell [ 2017 Dec 08 ]

I have a similar but much simpler use case - I need to use a returned {#JSONPATH} LLD macro value in the dependent item JSON pre-processor but it doesn't seem to work?

Comment by Michael Veksler [ 2018 May 17 ]

Available in pre-4.0.0alpha7 (trunk) r80928.

Comment by Alex Tomasello [ 2018 Sep 17 ]

Using Zabbix 4.0.0beta2, I've this issue

 
Item preprocessing step #1 failed: cannot extract value from json by path "$[?(@.serial == '{HOST.HOST}')].status": unsupported character in json path starting with: "[?(@.serial == '{HOST.HOST}')].status"

using an HTTP item that returns a Json:

[
    {
        "name": "xxx",
        "serial": "xxx",
        "status": "online"
    }
]
Comment by Vitaly Zhuravlev [ 2018 Sep 17 ]

alxtom, such JSONpath expression is not currently supported. See ZBXNEXT-4502

Generated at Fri Apr 26 02:06:06 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.