Jq

From Halfface
Jump to navigation Jump to search

create list of all keys in array.

curl -sk -H "Authorization: Bearer $(oc whoami -t)" https://$(oc get routes -n openshift-monitoring thanos-querier -o jsonpath='{.status.ingress[0].host}')/api/v1/metadata | jq .
echo '{
  "data": {
    "aggregator_openapi_v2_regeneration_count": [
      {
        "unit": ""
       }
    ],
    "alertmanager_alerts": [
      {
        "unit": ""
      }
    ]
  }
}' | jq -r '.data | keys | flatten[]'
aggregator_openapi_v2_regeneration_count
alertmanager_alerts