我正在尝试提取包含" cpu"的任何属性名称。和" usageRatio"来自下面的Json使用Jayway JsonPath,但到目前为止我一直没有运气。
检查了他们的文档,但找不到解决方案。有什么想法吗?
要清楚,我想以动态的方式提取所有cpu的cpu使用率(可能有很多核心):
{
"entries" : {
"cpu.0_1.user" : {
"lastUpdateMicros" : 1493578024979676,
"value" : 10167446,
"updateType" : "MOVING_AVERAGE"
},
"cpu.0_1.idle" : {
"value" : 277255191,
"lastUpdateMicros" : 1493578024979652,
"updateType" : "MOVING_AVERAGE"
},
"disk.usr.usageRatio" : {
"value" : 0.871294498443604,
"lastUpdateMicros" : 1493578024990246,
"updateType" : "BASIC"
},
"disk.shared.usedSpace" : {
"updateType" : "BASIC",
"lastUpdateMicros" : 1493578024990318,
"value" : 707563520
},
"disk.var.log.availableSpace" : {
"lastUpdateMicros" : 1493578024990355,
"value" : 7224614912,
"updateType" : "BASIC"
},
"disk.usr.local.www.guiserverroot.usr.local.www.guiserver.availableSpace" : {
"value" : 2369658880,
"lastUpdateMicros" : 1493578024990398,
"updateType" : "BASIC"
},
"cpu.0_0.idle" : {
"value" : 265264234,
"lastUpdateMicros" : 1493578024979593,
"updateType" : "MOVING_AVERAGE"
},
"cpu.0_1.usageRatio" : {
"value" : 0.07,
"lastUpdateMicros" : 1493578024979635,
"updateType" : "MOVING_AVERAGE"
},
"cpu.0_0.usageRatio" : {
"lastUpdateMicros" : 1493578024979564,
"value" : 0.12,
"updateType" : "MOVING_AVERAGE"
}
}
是的,我知道Json结构很糟糕,但遗憾的是我无法改变它。
/帕特里克