How Storage API can be used to get Azure Classic V

2019-01-29 04:53发布

问题:

Can we collect metrics for Azure Classic VM using Storage API or is there any other way to get the metrics for Azure Classic VM please suggest.

回答1:

To get the Azure VM metrics from a Azure Storage Service, you need to enable Diagnostics and configure the Storage Account on Azure portal.

After that, you will find that multi tables will be created to store the metrics.

The tables are with the following naming conventions:

  • WADMetrics : Standard prefix for all WADMetrics tables
  • PT1H or PT1M : Signifies that the table contains aggregate data over 1 hour or 1 minute
  • P10D : Signifies the table will contain data for 10 days from when the table started collecting data
  • V2S : String constant
  • yyyymmdd : The date at which the table started collecting data

Each WADMetrics table will contain the following columns:

  • PartitionKey: The partitionkey is constructed based on the resourceID value to uniquely identify the VM resource. for e.g. : - 002Fsubscriptions::002FresourceGroups:002F:002Fproviders:002FMicrosoft:002ECompute:002FvirtualMachines:002F
  • RowKey : Follows the format :. The descending time tick calculation is max time ticks minus the time of the beginning of the aggregation period. E.g. if the sample period started on 10-Nov-2015 and 00:00Hrs UTC then the calculation would be: DateTime.MaxValue.Ticks - (new DateTime(2015,11,10,0,0,0,DateTimeKind.Utc).Ticks). For the memory available bytes performance counter the row key will look like: 2519551871999999999__:005CMemory:005CAvailable:0020Bytes
  • CounterName : Is the name of the performance counter. This matches the counterSpecifier defined in the xml config.
  • Maximum : The maximum value of the performance counter over the aggregation period.
  • Minimum : The minimum value of the performance counter over the aggregation period.
  • Total : The sum of all values of the performance counter reported over the aggregation period.
  • Count : The total number of values reported for the performance counter.
  • Average : The average (total/count) value of the performance counter over the aggregation period.

To read the data from Azure Table, you could use Azure Table client library or Azure Table REST API.

Get started with Azure Table storage using .NET

Table Service REST API

Update 2017/07/18

my doubt is 20170709 is start date and 20170719 is end date am i right?

Yes, you are right.

Doubt 2.To access this table i need to create a POJO so how can i get the schema of the table meaning if maximum/minimum/Average is int/long/double/float

You can open a entity of the table from Azure Storage Explorer. You will see the type of the columns. For example,

Doubt 3. how to query WADMetricsPT1HP10DV2S20170709 to get metrics for one particular hour?

You could query the data by Timestamp.



回答2:

Can we collect metrics for Azure Classic VM using Storage API

By collect metrics, if you mean the process of capturing the metrics data then the answer is no. You can't use Storage API to do that. You would need to use the Metrics API for that purpose. Data collected by this API will store the data in Azure Storage.

Once the data is in Azure Storage, then you can use Storage API to get that data. Depending on where the data is stored (Blobs and/or Tables), you would use appropriate parts of Storage API to fetch and manage that data.