Right now I'm viewing the Azure NetApp volume metrics using Azure Portal metrics dashboard.I can see only one month old data. I'm planning to collect this data and save into SQL table. So that I have the history of this data (ie more than 30 days). Is there a powershell commands that I can use?
As per Azure NetApp Files: PowerShell One-Liners , you can use Get-AzMetric
, provide StartTime
and EndTime
to get the history of data.
Try the following code snippet taken from the document, for example:
Get-AzResource | Where-Object {$_.ResourceType -like 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes'}
| Get-AzNetAppFilesVolume | Select-Object @{Name='ShortName'; Expression={$_.Name.split('/')[2]}}, @{Name='SizeGiB';
Expression={$_.UsageThreshold / 1024 / 1024 / 1024}},
@{Name='ConsumedGiB';
Expression={[math]::Round($((Get-AzMetric -ResourceId $_.Id -MetricName 'VolumeLogicalSize'
-StartTime $(get-date).AddMinutes(-15) -EndTime $(get-date) -TimeGrain 00:5:00 -WarningAction SilentlyContinue
| Select-Object -ExpandProperty data | Select-Object -ExpandProperty Average) | Measure-Object -average).average / 1024 / 1024 / 1024, 2)}} | Format-Table
You can refer to PowerShell and CLI for Azure NetApp Files and Azure NetApp Files metrics
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.