当我尝试使用AZURE REST API为某些m / c收集VM的指标时,我获得了数据平均值的指标,对于一些m / c我总得到数据请帮我解决这个问题,我想得到只有最后5分钟的平均数据。
我正在使用以下网址
https://management.azure.com/subscriptions/{subscription_ID}/resourceGroups/rg-np-eastjp-vnet-10-198-0-0-24/providers/Microsoft.Compute/virtualMachines/vm-dev-eastjp-waf/providers/microsoft.insights/metrics?api-version=2016-09-01&$filter=%28+name.value+eq+%27Network+In%27+or++name.value+eq+%27Network+Out%27+or++name.value+eq+%27Percentage+CPU%27+or++name.value+eq+%27Disk+Read+Bytes%27+or++name.value+eq+%27Disk+Write+Bytes%27+or++name.value+eq+%27Disk+Read+Operations%2FSec%27+or++name.value+eq+%27Disk+Write+Operations%2FSec%27++%29+and+timeGrain+eq+duration%27PT5M%27+and+startTime+eq+2017-12-08T12%3A58%3A41.729+and+endTime+eq+2017-12-08T13%3A03%3A41.729+
以下是总计的O / P:
{
"value":[
{
"data":[
{
"timeStamp":"2017-12-11T08:19:00Z",
"total":1791478.0
}
],
"id":"/subscriptions/{subscription_ID}/resourceGroups/MWatchLab-dev-db-mcs-473968/providers/Microsoft.Compute/virtualMachines/dev-db-mcs/providers/Microsoft.Insights/metrics/Network In",
"name":{
"value":"Network In",
"localizedValue":"Network In"
},
"type":"Microsoft.Insights/metrics",
"unit":"Bytes"
},
{
"data":[
{
"timeStamp":"2017-12-11T08:19:00Z",
"total":1503183.0
}
],
"id":"/subscriptions/{subscription_ID}/resourceGroups/MWatchLab-dev-db-mcs-473968/providers/Microsoft.Compute/virtualMachines/dev-db-mcs/providers/Microsoft.Insights/metrics/Network Out",
"name":{
"value":"Network Out",
"localizedValue":"Network Out"
},
"type":"Microsoft.Insights/metrics",
"unit":"Bytes"
},
{
"data":[
{
"timeStamp":"2017-12-11T08:19:00Z",
"total":896.99
}
],
"id":"/subscriptions/{subscription_ID}/resourceGroups/MWatchLab-dev-db-mcs-473968/providers/Microsoft.Compute/virtualMachines/dev-db-mcs/providers/Microsoft.Insights/metrics/Percentage CPU",
"name":{
"value":"Percentage CPU",
"localizedValue":"Percentage CPU"
},
"type":"Microsoft.Insights/metrics",
"unit":"Percent"
},
{
"data":[
{
"timeStamp":"2017-12-11T08:19:00Z",
"total":0.0
}
],
"id":"/subscriptions/{subscription_ID}/resourceGroups/MWatchLab-dev-db-mcs-473968/providers/Microsoft.Compute/virtualMachines/dev-db-mcs/providers/Microsoft.Insights/metrics/Disk Read Bytes",
"name":{
"value":"Disk Read Bytes",
"localizedValue":"Disk Read Bytes"
},
"type":"Microsoft.Insights/metrics",
"unit":"Bytes"
},
{
"data":[
{
"timeStamp":"2017-12-11T08:19:00Z",
"total":5022690.87
}
],
"id":"/subscriptions/{subscription_ID}/resourceGroups/MWatchLab-dev-db-mcs-473968/providers/Microsoft.Compute/virtualMachines/dev-db-mcs/providers/Microsoft.Insights/metrics/Disk Write Bytes",
"name":{
"value":"Disk Write Bytes",
"localizedValue":"Disk Write Bytes"
},
"type":"Microsoft.Insights/metrics",
"unit":"Bytes"
},
{
"data":[
{
"timeStamp":"2017-12-11T08:19:00Z",
"total":0.0
}
],
"id":"/subscriptions/{subscription_ID}/resourceGroups/MWatchLab-dev-db-mcs-473968/providers/Microsoft.Compute/virtualMachines/dev-db-mcs/providers/Microsoft.Insights/metrics/Disk Read Operations/Sec",
"name":{
"value":"Disk Read Operations/Sec",
"localizedValue":"Disk Read Operations/Sec"
},
"type":"Microsoft.Insights/metrics",
"unit":"CountPerSecond"
},
{
"data":[
{
"timeStamp":"2017-12-11T08:19:00Z",
"total":10.77
}
],
"id":"/subscriptions/{subscription_ID}/resourceGroups/MWatchLab-dev-db-mcs-473968/providers/Microsoft.Compute/virtualMachines/dev-db-mcs/providers/Microsoft.Insights/metrics/Disk Write Operations/Sec",
"name":{
"value":"Disk Write Operations/Sec",
"localizedValue":"Disk Write Operations/Sec"
},
"type":"Microsoft.Insights/metrics",
"unit":"CountPerSecond"
}
]
}