Monitoring Azure Storage using REST API - azure

I was monitoring microsoft.compute using a REST API Client and I was hoping that I could do the same for microsoft.storage. But unfortunately I get an error response while trying to do so
{
"code": "ResourceNotSupported",
"message": "Resource provider not supported: microsoft.storage"
}
The Rest API call I make is something similar to this
https://management.azure.com/subscriptions/xxxxxxxx/resourceGroups/xxxxx/providers/Microsoft.Storage/storageAccounts/xxxxx/providers/microsoft.insights/metricdefinitions?api-version=2016-03-01
Is there any way to get storage metrics from a REST API client?

Storage metrics are stored in a table called $MetricsTransactionsBlob. You will need to use the data plane APIs described in this link.
Simply you will need to access and query the table at https://<accountname>.table.core.windows.net/Tables("$MetricsTransactionsBlob")

There is no Azure Insights for Azure storage. You can use Storage analytics to get at the monitoring data that's stored in associated Table storage of the monitored account, but this will fail for Blob and Premium storage accounts. This is a big oversight from the Azure API perspective. For Standard Azure storage, you can get at the metric tables via the link that #Sercan provided.
If you're trying to monitor utilization of your VM disks on Premium or Blob accounts, you can use Physical Disk performance counters on the actual VMs to measure the throughput, IO requests, etc. This is what we advise our CloudMonix users do when they have this need.

Related

Getting data out of the Azure Cost Centre

Looking for a method to export data outside of the Azure Cost Centre into a storage account. This can't be done because of network restrictions on a storage account (i.e. firewall rules with selected networks prevents the Azure Cost Centre from exporting data to a storage account).
what is the workaround? Can a datafactory do this instead with APIs? Can an Azure function do this? what are some of the options available?
Can a datafactory do this instead with APIs?
No, Both Logic App and Azure Data Factory has no connector to Azure Cost Centre.
Can an Azure function do this?
Yes, you can use function to do this. You can do a Http request to get data from Azure Cost Centre and then upload a file with that data to Storage Blob.

Azure Metrics for Virtual Machine

I am trying to obtain metrics for an Azure Virtual Machine. The standard Insights API provided doesn't provide all the metrics. Upon more reading I found that these metrics are stored in Azure Storage Accounts under different tables. Is there a way to make an API call to these tables and retrieve the metrics ?
There are two categories of metrics for Azure Virtual Machine -- host level metrics that are derived from Hyper V performance counters and the guest level metrics that come from within the VM itself.
For host level metrics, the Insights REST API provides access to this data.
https://learn.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-overview-metrics
For guest metrics such as Memory metrics, you need to install the diagnostics agent to collect this data to one of the supported sink types such as storage account, event hub, or Application Insights. If you collect this data to storage account or event hub, you need to use the standard storage API or event hub API to access this data. Specifically for storage, the data will be stored in WADPerformanceCountersTable in Azure table storage. There is no additional REST API to retrieve this data outside of the existing storage API.
https://learn.microsoft.com/en-us/azure/monitoring-and-diagnostics/azure-diagnostics

How can I tell how full an Azure Storage account is?

Is there any way of determining the used and/or remaining capacity of an Azure Storage account? I know that the current size limit is 100TB per storage account and I'm looking for either number of bytes used/remaining or, failing that, percentage used/remaining. However I can't see any way of monitoring this even in the Azure portal, let alone doing it programmatically via the API.
You have to enable Storage Analytics. Then read about Storage Account Monitoring.
Finally a look at the Analytics Metrics table(s). Note that it takes minimum 15 minutes until metrics are updated.
And btw, Azure Storage account limit is 500 TB as per Azure Subscription and Service Limits.
UPDATE
After reconsidering, the only way you can get the full storage capacity report is via the Account Billing page. Simply click on your name on top right (management portal v.Current, a.k.a. https://manage.windowsazure.com/) then chose "View My Bill" option.
This page is updated on a daily basis.
There is no API or other programmatic way to get these statistics.
Now it's possible to get it in Azure Monitor. In Azure Portal navigate to All services -> Monitor, click Expore Metrics and select your storage account. There are different useful metrics and Capacity metric is among them.
If you open the storage account in the Azure Portal, there is a Metrics tab (in the menu on the left, not a conventional tab) which will provide you with graphs on account utilisation including used capacity.
This tab works even without usage of Storage Analytics or the Azure Monitor.
Storage Metrics only stores capacity metrics for the blob service because blobs typically account for the largest proportion of stored data (at the time of writing, it is not possible to use Storage Metrics to monitor the capacity of your tables and queues). You can find this data in the $MetricsCapacityBlob table if you have enabled monitoring for the Blob service. Take a look at this Monitoring Capacity document for information on how to monitor the capacity of your storage accounts.
For help estimating the size of various storage objects such as blobs, see the blog post Understanding Azure Storage Billing – Bandwidth, Transactions, and Capacity. Understanding Storage Billing,
Note that Storage does have API's for access metric data programmatically using the CloudAnalyticsClient API. See CloudAnalyticsAPI for a summary.

Azure Rest API Read VM Peformance Metrics

I am trying the read the performance metrics of vms in the azure cloud using the rest api. As per the this link ( azure documentation ) http://www.windowsazure.com/en-us/documentation/articles/cloud-services-how-to-monitor/#accessverbose
but when i try to fetch the tables that are available for a particular from a storage account i am not getting empty table list.
Please correct me what the ways we can capture vm performance metrics using the rest api to integrate with 3rd party system management providers.

Azure storage metrics data

I am trying to implement azure storage metrics code in my role but i am checking if there is easy way to get azure storage metric data about my files usage. my code is stable and i do not want to change code again.
Actually if you already have Windows Azure role running, then you don't need to make any changes to your code and you still can get Windows Azure Blob storage Metrics data.
I have written a blog about it last time as Collecting Windows Azure Storage REST API level metrics data without a single line of programming, just by using tools
Please try above and see if this works for you.
Storage analytics is disabled by default, so any operations against your storage up til now has not been logged for analysis.
You may choose to enable analytics at any time, for both logging (detailed access information for every single object) and metrics (hourly rollups). Further, you may choose which specific storage service to track (blobs, tables, queues) and which operations to track (read, write, delete). Once analytics are enabled, you may access the resulting analytics data from any app (as long as you have the storage account name + key).
Persistent Systems just published a blog post on enabling storage analytics for Java apps. The same principles may be applied to a .net app (and the sdk's are very similar).
Additionally, Full Scale 180 published a sample app encapsulating storage analytics (based on REST API, as it was written before SDK v1.6 came out).

Resources