Maybe we can use this Azure PowerShell command Get-AzureRmMetric
to get CPU usage.
We can use Get-AzureRmMetricDefinition
to get the supported metrics, here are the metrics of Azure VM:
PS D:estdata> (Get-AzureRmMetricDefinition -ResourceId $id).name
Value LocalizedValue
----- --------------
Percentage CPU Percentage CPU
Network In Network In
Network Out Network Out
Disk Read Bytes Disk Read Bytes
Disk Write Bytes Disk Write Bytes
Disk Read Operations/Sec Disk Read Operations/Sec
Disk Write Operations/Sec Disk Write Operations/Sec
CPU Credits Remaining CPU Credits Remaining
CPU Credits Consumed CPU Credits Consumed
More information about supported metrics of Azure VM, please refer to this link.
Then we can use the value to get metrics:
Get-AzureRmMetric -ResourceId $id -TimeGrain 00:01:00 -DetailedOutput -MetricNames "Network in"
Here is the PowerShell output:
If your Azure PowerShell version is 3.4.0, we can use this command to get guest metrics:
Hope it helps:)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…