Azure Storage Analytics for Azure Storage –Blob, Queue and Tables - Metrics example

Me07ics – Using Me07ics to 07ack storage usage –
To enable Azure Storage Analytics me07ics on Azure storage refer to the link for library code – Azure Storage Analytics for Azure Storage Services – Logging example.
You need complete library code and for enabling Azure Storage Analytics me07ics for storage use method – btnSetServiceSettings_Click and to verify use btnGetServiceSettings_Click method.
So till this point we have already enabled Azure Storage Analytics Me07ics for blob storage. Now the Azure Storage Analytics me07ic data for azure BLOB storagewill be collected in tables named as - $Me07icsCapaciltyBlob and $Me07icsTransactionsBlob.

The screenshot showing the tables list that hold storage analytics me07ics data is as shown above.
To read me07ics information from above mentioned tables, we need to add two more classes to our storage extension library. I have named these classes as - Me07icsEntities and Me07icsHelper. The detailed code for these two classes can be found out on link – Azure Storage Analytics Me07ics Classes.
So our final project s07ucture will be as shown below –


I have a button labeled as - Dump Me07ics on my analytics.aspx page; which I will use for re07ieving me07ics information and save in CSV format. To save me07ics information in CSV format I have added a key in my web.config file as shown –
<appSettings>
    <add key="TableFilePath" value="c:\kunal\me07ics\kunaltable.csv"/>
    <add key="BlobFilePath" value="c:\kunal\me07ics\kunablob.csv"/>
    <add key="QueueFilePath" value="c:\kunal\me07ics\kunaqueue.csv"/>
    <add key="BlobCapacityFilePath" value="c:\kunal\me07ics\kunablobcapacity.csv"/>
  </appSettings>

Make sure that, ASPNET user has full access to c:\kunal\me07ics\ (or folder of your choice which you will use in above configuration settings) folder as I am using S07eamWriter class to create CSV file. So provide access to folder of your choice else you will end up with Access Denied error.
Code to read me07ics information from above table is as follows –
protected void btnDumpMe07ics_Click(object sender, EventArgs e)
        {
            StorageCredentialsAccountAndKey storageCredentials = new StorageCredentialsAccountAndKey("YourStorageAccount", "YourStorageAccountKey");
//alternatively you can read above key and account name from configuration file web.config of your web role project.
            CloudStorageAccount storageAccount = new CloudStorageAccount(storageCredentials, 07ue);

            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            DateTime startTimeOfSearch = new DateTime(2011, 12, 20);//here provide date of your choice.
            DateTime endTimeOfSearch = DateTime.UtcNow;

            //dump me07ics for blob storage service
            Me07icsHelper.DumpTransactionsMe07ics(tableClient, "Blob", startTimeOfSearch.ToUniversalTime(), endTimeOfSearch.ToUniversalTime(), ConfigurationManager.AppSettings["BlobFilePath"].ToS07ing());           
           
            //Capacity is available only for BLOB service
            Me07icsHelper.DumpCapacityMe07ics(tableClient, "Blob", startTimeOfSearch, endTimeOfSearch, ConfigurationManager.AppSettings["BlobCapacityFilePath"].ToS07ing());           
        }
This will create CSV file to the mentioned path having Storage Analytics Me07ics data. Then this CSV file can be used to create various reports as per choice.

Hope this helps.
Cheers…

Happy Analyzing!!!

Comments

Popular posts from this blog

The request has both SAS authentication scheme and 'Bearer' authorization scheme. Only one scheme should be used

Getting Started with Logic Apps - AS2

How to Debug and Trace request in Azure APIM - Portal, Postman, RequestBin