Hello @Goud Kanthi, Aniketh ,
Thanks for your query !
To retrieve those metrics first you might want to enable the diagnostics for that VM.
Go to VM -> Monitoring -> Diagnostics Settings: (Follow the remaining steps)
You can select the required metrics like below:
Performance counters
Collecting data for these counters:
CPU
Memory
Disk
Network
Once you enable those , it will deploy an extension
Microsoft.Azure.Performance.Diagnostics.AzurePerformanceDiagnostics
As a part of enabling that extension , you will have to choose the storage account where all the required metrics will be stored.
In that particular storage account , it will create corresponding tables with name WADMetricsPT* .
Table data and columns looks like below:
You will have to write a C#.net program using Azure API's to query that storage account tables data.
Sample high level piece of code to connect to azure storage table and retrieve the data:
<add key="StorageConnectionString" value="DefaultEndpointsProtocol=https;
AccountName=[Name of storage account];AccountKey=[Access Key for storage account]">
CloudStorageAccount cloudStorageAccount =
CloudStorageAccount.Parse
(ConfigurationManager.AppSettings["StorageConnectionString"]);
CloudTableClient tableClient = cloudStorageAccount.CreateCloudTableClient();
string tableName = "tablename"
CloudTable cloudTable = tableClient.GetTableReference(tableName);
TableOperation tableOperation = TableOperation.Retrieve(partitionKey, rowKey);
TableResult tableResult = table.Execute(tableOperation);
Please Note: You will have to query the corresponding Metrics which is available in CounterName Column
Kindly let us know if you need additional help on this.
Regards,
Shiva.