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

JSON Data truncated on dependent item

    XMLWordPrintable

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Major
    • Resolution: Won't fix
    • Affects Version/s: 3.4.4
    • Fix Version/s: None
    • Component/s: Server (S)
    • Labels:
    • Environment:
      Centos 6

      Description

      Collecting data via JSON - when I try and query the JSON in a dependent variable I get 'missing terminator' - think we have a (silent) buffer overflow...

      I know the json path is wrong in the error below but it fails when using a valid json path even into the first JSON block ($.STATUS[0].When), but this query works with the shorter master JSON data below.

      'Master item' returns * (correct JSON - length ~1298)

      {"STATUS":[{"STATUS":"S","When":1512549370,"Code":70,"Msg":"CGMiner stats","Description":"cgminer 4.9.0"}], "STATS":[{"CGMiner":"4.9.0","Miner":"1.0.1.3","CompileTime":"Fri Aug 25 17:28:57 CST 2017","Type":"Antminer L3+"}{"STATS":0,"ID":"L30","Elapsed":57217,"Calls":0,"Wait":0.000000,"Max":0.000000,"Min":99999999.000000,"GHS 5s":"502.601","GHS av":500.84,"miner_count":4,"frequency":"384","fan_num":2,"fan1":2550,"fan2":3030,"temp_num":4,"temp1":53,"temp2":49,"temp3":49,"temp4":47,"temp2_1":59,"temp2_2":54,"temp2_3":55,"temp2_4":54,"temp31":0,"temp32":0,"temp33":0,"temp34":0,"temp4_1":0,"temp4_2":0,"temp4_3":0,"temp4_4":0,"temp_max":53,"Device Hardware%":0.0000,"no_matching_work":59,"chain_acn1":72,"chain_acn2":72,"chain_acn3":72,"chain_acn4":72,"chain_acs1":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo","chain_acs2":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo","chain_acs3":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo","chain_acs4":" oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo oooooooo","chain_hw1":39,"chain_hw2":20,"chain_hw3":0,"chain_hw4":0,"chain_rate1":"125.16","chain_rate2":"126.01","chain_rate3":"125.82","chain_rate4":"125.61"}],"id":1}
      

      Dependent item returns error:

      Item preprocessing step #1 failed: cannot extract value from json by path "$.stats[1].temp2": cannot parse as a valid JSON object: invalid array format, expected closing character ']' at:
      '{"STATS":0,"ID":"L30","Elapsed":57457,"Calls":0,"Wait":0.000000,"Max":0.000000,"Min":99999999.000000,"GHS 5s":"504.076","GHS av":500.84,"miner_count":4,"freque
      

      BUT I don't think the truncation occurs at that point ('frequency') - I think the error message has truncated it further.
      The JSON value ($.STATS[1]) we are interested in is ~1072 chars from { to } so it may be a limit in the max size of JSON element rather than the whole JSON string.

      The following JSON works correctly:
      Master JSON - length ~ 685

      {"STATUS":[{"STATUS":"S","When":1512550514,"Code":11,"Msg":"Summary","Description":"cgminer 4.9.0"}],"SUMMARY":[{"Elapsed":58361,"GHS 5s":"503.67","GHS av":500.81,"Found Blocks":19,"Getworks":10064,"Accepted":2383,"Rejected":9,"Hardware Errors":61,"Utility":2.45,"Discarded":49094,"Stale":0,"Get Failures":2,"Local Work":100466,"Remote Failures":1,"Network Blocks":3815,"Total MH":29227837.0000,"Work Utility":448044.13,"Difficulty Accepted":432836915.00000000,"Difficulty Rejected":2967552.00000000,"Difficulty Stale":0.00000000,"Best Share":422758382,"Device Hardware%":0.0000,"Device Rejected%":0.6809,"Pool Rejected%":0.6809,"Pool Stale%":0.0000,"Last getwork":1512550512}],"id":1}
      

      and I can query both

      $.SUMMARY[0].Getworks
      

      and

      $.STATUS[0].When
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            djmuk David Mitchell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: