Ad Widget

Collapse

Converting json key/value array to jsonpath?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gadg3ts
    Junior Member
    • Jan 2020
    • 11

    #1

    Converting json key/value array to jsonpath?

    Hello,
    So I'm trying to convert this stats output to something I can use in a zabbix discovery:
    Contribute to nanopool/BoringAPI development by creating an account on GitHub.


    The problem is getting the list of GPU's to use as a macro for getting the other paths...
    The more direct values like Total Hashrate work fine, as they have a simple path structure.

    In JQ I can get this:
    cat nanominer-stats.out | jq '.Devices[] | to_entries | map(select(.key | match("GPU";"i") )) | map(.key)'
    [
    "GPU 0",
    "GPU 1",
    "GPU 2"
    ]

    but I've not been able to find how to do the equivalent in jsonpath, or if indeed you can...
    Anyone have any ideas?
    I've considered doing the gpu.discovery as an agent parameter, but I'd prefer to keep everything as a dependent item from the initial http request.

    Thanks,
    Sean
Working...