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

JSON Path preprocessing not working in dependent items

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • 4.2.8
    • Server (S)
    • None

      Hello,

      I created a template with a system.run master item returning JSON (both in standard output and in a file) :

      [ { "api_id" : "5c97f547ae1cf63c351a1552", "function_id" : "5c56f986fe09e73cf21b5b66", "hour" : "21" , "total_success" : 3, "total_failures" : 0, "total_calls" : 3 }, { "api_id" : "5c97f547ae1cf63c351a1552", "function_id" : "5e74b52bae1cf600e62ec3dd", "hour" : "21" , "total_success" : 2, "total_failures" : 0, "total_calls" : 2 }, { "api_id" : "5c97f547ae1cf63c351a1552", "function_id" : "5e74b52bae1cf600e62ec3e0", "hour" : "21" , "total_success" : 1, "total_failures" : 0, "total_calls" : 1 }, { "api_id" : "5c97f547ae1cf63c351a1552", "function_id" : "5c97ffb5ae1cf63c222c11d3", "hour" : "21" , "total_success" : 743, "total_failures" : 0, "total_calls" : 743 }, { "api_id" : "5c97f547ae1cf63c351a1552", "function_id" : "5c97f547ae1cf63c351a155a", "hour" : "21" , "total_success" : 24, "total_failures" : 0, "total_calls" : 24 }, { "api_id" : "5c97f547ae1cf63c351a1552", "function_id" : "5d32d51cfe09e7e38d57884e", "hour" : "21" , "total_success" : 297, "total_failures" : 0, "total_calls" : 297 }, { "api_id" : "5c97f547ae1cf63c351a1552", "function_id" : "5c56fe95fe09e78cac2ca04c", "hour" : "21" , "total_success" : 10, "total_failures" : 0, "total_calls" : 10 }, { "api_id" : "5c97f547ae1cf63c351a1552", "function_id" : "5c45ef1ffe09e757db7b1951", "hour" : "21" , "total_success" : 297, "total_failures" : 0, "total_calls" : 297 }]

       

      • Then, a LLD rule based on the content of that file creates several items from prototypes. These items are dependent items from the json master item and are supposed to return the values of the different "total_" fields of the json thanks to jsonpath preprocessing (see attachment). The preprocessing is defined that way : *$.total_success (attachment 2)
      • In these items names, I use LLD macros, to get values from the json, and it works fine (attachment 1, 3 and 4).

       

      • But I get an error with my protoype items values  (see attachement 3) :

      "Preprocessing failed for [...]. Failed: cannot extract value from json by path "$.total_success". object not found starting with json path: "total_success"

       

      NB :

      Sythax "$[1].total_success" works, but only get first occurence of total_success value fr each item... Not really useful...

      Syntax "$[*].total_success" or "$..total_success" don't work...

       

      Do you have any idea why my jsonpath definition works fine in the names of the items (from my LLD macros), but not in the values of the items (from the preprocessing jsonpath) please ?

       

        1. 1-ItemPrototype-def.png
          1-ItemPrototype-def.png
          36 kB
        2. 2-ItemPrototype-preprocessing.png
          2-ItemPrototype-preprocessing.png
          19 kB
        3. 3-JSONPath-Error.png
          3-JSONPath-Error.png
          45 kB
        4. 4-LLDMacros.png
          4-LLDMacros.png
          29 kB
        5. 6-JSONPath-1-totalsuccess.png
          6-JSONPath-1-totalsuccess.png
          12 kB
        6. 6-JSONPath-Test.png
          6-JSONPath-Test.png
          14 kB
        7. Sin título.png
          Sin título.png
          48 kB
        8. Sin título2.png
          Sin título2.png
          23 kB

            Unassigned Unassigned
            zabbixuserfk FK
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: