我有以下JSON结构作为Azure CLI调用的结果:
az network application-gateway show-backend-health `
--resource-group $resourceGroup `
--name $appGatewayName `
Json:
{
"backendAddressPools": [
{
"backendAddressPool": {
"id": "someid",
"resourceGroup": "rg-myresourcegroup"
},
"backendHttpSettingsCollection": [
{
"backendHttpSettings": {
"id": "someid",
"resourceGroup": "rg-myresourcegroup"
},
"servers": [
{
"address": "10.96.130.133",
"health": "Unhealthy",
"healthProbeLog": "Received invalid status code: 503 in the backend server’s HTTP response. As per the health probe configuration, 200-399 is the acceptable status code. Either modify probe configuration or resolve backend issues. To learn more visit - https://aka.ms/StatusCodeMismatch.",
"ipConfiguration": {
"id": "someid",
"resourceGroup": "rg-myresourcegroup"
}
},
{
"address": "10.96.130.134",
"health": "Healthy",
"healthProbeLog": "OK",
"ipConfiguration": {
"id": "someid",
"resourceGroup": "rg-myresourcegroup"
}
}
]
}
]
}
]
}
我的目标是查询特定IP地址的健康状态。
我试过几种方法,但都行不通。
backendAddressPools[].backendHttpSettingsCollection[].servers[?address='10.96.130.134']
backendAddressPools[].backendHttpSettingsCollection[][?servers.address='10.96.130.134']
JSMEPath playground查看数据
你知道我哪里做错了吗?正确的查询应该是什么?
1条答案
按热度按时间p5cysglq1#
找到了答案。这是一个语法错误,我需要
==
而不是=
。这是结果查询: