- Initial json input
{
"nodes": [
{
"name": "crc-4727w-master-0",
"cpu": 75,
"memory": 82
},
{
"name": "crc-4727w-worker-0",
"cpu": 65,
"memory": 70
},
{
"name": "crc-4727w-worker-1",
"cpu": 60,
"memory": 68
}
]
}
- The jq select filter with a comparison
- Is going to show the nodes that the cpu usage is greater than 70% OR the memory usage is greater than 90%
jq '.nodes[] | select(.cpu >=70 or .memory >=90)'
- Result
{
"name": "crc-4727w-master-0",
"cpu": 75,
"memory": 82
}