Created
April 21, 2021 14:08
-
-
Save shawnweisfeld/038d926e462872f72ae88fe896e29ad2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Variables | |
SUB="your azure subscription guid" | |
RG="the resource group your storage account is in" | |
STORAGEACCT="the short name of your storage account" | |
# Resource strings to the account and to the blob service | |
RESOURCE="/subscriptions/$SUB/resourceGroups/$RG/providers/Microsoft.Storage/storageAccounts/$STORAGEACCT" | |
BLOBRESOURCE="/subscriptions/$SUB/resourceGroups/$RG/providers/Microsoft.Storage/storageAccounts/$STORAGEACCT/blobServices/default" | |
# what information can I find out? | |
az monitor metrics list-definitions --resource $RESOURCE > defn.json | |
az monitor metrics list-definitions --resource $BLOBRESOURCE > blobdefn.json | |
# Get me info at the account level | |
az monitor metrics list --resource $RESOURCE --metric UsedCapacity --interval 1h --offset 1h | |
# Get me info for just blob storage | |
az monitor metrics list --resource $BLOBRESOURCE --metric BlobCapacity --interval 1h --offset 1h | |
az monitor metrics list --resource $BLOBRESOURCE --metric BlobCount --interval 1h --offset 1h | |
# Get me info for hot blob storage | |
az monitor metrics list --resource $BLOBRESOURCE --metric BlobCapacity --interval 1h --offset 1h --filter "Tier eq 'Hot'" | |
az monitor metrics list --resource $BLOBRESOURCE --metric BlobCount --interval 1h --offset 1h --filter "Tier eq 'Hot'" | |
# Get me info for archive blob storage | |
az monitor metrics list --resource $BLOBRESOURCE --metric BlobCapacity --interval 1h --offset 1h --filter "Tier eq 'Archive'" | |
az monitor metrics list --resource $BLOBRESOURCE --metric BlobCount --interval 1h --offset 1h --filter "Tier eq 'Archive'" | |
# Java examples | |
# https://github.com/Azure-Samples/monitor-java-query-metrics-activitylogs | |
# https://github.com/Azure-Samples/monitor-java-query-metrics-activitylogs/blob/2f6c125b7bf586eed9c702de71cd911524a723b2/src/main/java/com/azure/resourcemanager/monitor/samples/QueryMetricsAndActivityLogs.java#L92 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment