Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-4502

Support of 'advanced' JSON Path expressions

XMLWordPrintable

    • 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/

        1. image-2019-06-04-15-08-35-646.png
          42 kB
          Roberto Cremasco
        2. jsonpath_sum.diff
          2 kB
          Andris Zeila

            wiper Andris Zeila
            vzhuravlev Vitaly Zhuravlev
            Team A
            Votes:
            45 Vote for this issue
            Watchers:
            45 Start watching this issue

              Created:
              Updated:
              Resolved: