-
New Feature Request
-
Resolution: Fixed
-
Major
-
None
-
Sprint 52 (May 2019), Sprint 53 (Jun 2019), Sprint 54 (Jul 2019)
-
5
Together with ZBXNEXT-4200 and ZBXNEXT-4163, support of 'advanced' JSON Path expressions is required to select specific JSON object's attribute from the item.
For example (mentioned in ZBXNEXT-4163)
Is there any possibility of using LLD MACROS in item preprocessing.
For example process JSON based on LLD result:
like:
1.
[JSON Path] | $.data[?(@.CHECKNAME == '{#CHECKNAME}' )].value |
2. Another example from openstack cinder:
JSON response:
{ "pools": [ { "capabilities": { "QoS_support": false, "allocated_capacity_gb": 3, "driver_version": "3.0.0", "filter_function": null, "free_capacity_gb": 7.01, "goodness_function": null, "location_info": "LVMVolumeDriver:devstack-ubuntu16:stack-volumes-lvmdriver-1:default:0", "max_over_subscription_ratio": 1.0, "multiattach": true, "pool_name": "lvmdriver-1", "provisioned_capacity_gb": 3.0, "reserved_percentage": 0, "storage_protocol": "iSCSI", "thick_provisioning_support": true, "thin_provisioning_support": false, "timestamp": "2017-10-17T13:14:17.014588", "total_capacity_gb": 10.01, "total_volumes": 2, "vendor_name": "Open Source", "volume_backend_name": "lvmdriver-1" }, "name": "devstack-ubuntu16@lvmdriver-1#lvmdriver-1" }, { "capabilities": { "QoS_support": false, "allocated_capacity_gb": 0, "driver_version": "3.0.0", "filter_function": null, "free_capacity_gb": 8.01, "goodness_function": null, "location_info": "LVMVolumeDriver:devstack-ubuntu16:stack-volumes-lvmdriver-1:default:0", "max_over_subscription_ratio": 1.0, "multiattach": true, "pool_name": "lvmdriver-1", "provisioned_capacity_gb": 3.0, "reserved_percentage": 0, "storage_protocol": "iSCSI", "thick_provisioning_support": true, "thin_provisioning_support": false, "timestamp": "2017-10-17T13:14:21.222133", "total_capacity_gb": 10.01, "total_volumes": 2, "vendor_name": "Open Source", "volume_backend_name": "lvmdriver-1" }, "name": "devstack-ubuntu16@custom-type#lvmdriver-1" } ] }
In order to get free space from specific pool you would need JSON path like this to work in preprocessing:
$.pools[?(@.name == "devstack-ubuntu16@custom-type#lvmdriver-1")].capabilities.free_capacity_gb
And It looks like that this is not going to work at the moment.
More expression examples:
http://goessner.net/articles/JsonPath/