Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-20553

JSONpath user macro evaluation

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • None
    • None
    • None
    • None

      https://www.zabbix.com/forum/zabbix-help/439249-jsonpath-preprocessing

      Zabbix 5.4.10 CentOS appliance

      JSON sample:
      {
      "Intf": "0/1",
      "Detection": "Unknown",
      "Class": "Unknown",
      "Consumed": "0.00",
      "Voltage": "0.00",
      "Current": "0.00",
      "WattHr": "0.00",
      "Temperature": "N/A"
      },
      {
      "Intf": "0/2",
      "Detection": "Unknown",
      "Class": "Unknown",
      "Consumed": "0.00",
      "Voltage": "46.81",
      "Current": "0.00",
      "WattHr": "0.00",
      "Temperature": "N/A"
      },
      

      Data scraped from network switch, converted from CSV to JSON in item preprocessing.
      discovery rule on json data has LLD macro {#IF} = "..Intf
      item prototype uses JSONpath preprocessing:

      $.[?(@.Intf == {$IF})].Voltage

      If I have quotes around the macro I get "no data matches the specified path" which is likely because it is a valid jsonpath but no results.
      If I DO NOT use quotes I get an invalid construct.

      Copying and pasting the paths and sample data into online parsers works.

      Of note, I am using the same macro in the name of the item prototype and it resolves to
      Interface ["0/2"] voltage:

      The macro is also in the key and resolves to
      shitSw.["[\"0/2\"].Volt"]

            neogan Andrei Gushchin (Inactive)
            noobz Damon Hagerstrom
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: