Jq: Difference between revisions

From Halfface
Jump to navigation Jump to search
(Created page with "=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[]' /tmp/tmp.json aggre...")
 
Line 14: Line 14:
     ]
     ]
   }
   }
  }' | jq -r '.data | keys | flatten[]' /tmp/tmp.json
  }' | jq -r '.data | keys | flatten[]'
  aggregator_openapi_v2_regeneration_count
  aggregator_openapi_v2_regeneration_count
  alertmanager_alerts
  alertmanager_alerts

Revision as of 08:13, 5 May 2023

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