Hi,
I'm new to Azure, could anyone help me while I'm trying to build C# application to retrieve the VM Metrics data
Metrics are:
1. CPU utlization
2. RAM Usage
3. Logical disk space used.
Can anyone help me with this.
Hi,
I'm new to Azure, could anyone help me while I'm trying to build C# application to retrieve the VM Metrics data
Metrics are:
1. CPU utlization
2. RAM Usage
3. Logical disk space used.
Can anyone help me with this.
@GoudKanthiAniketh-4694 Any update on the issue?
If the suggested response helped you resolve your issue, do click on "Mark as Answer" for the answer that helped you for benefit of the community.
Thanks.
Hello @GoudKanthiAniketh-4694 ,
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.
Thank you shivapatpi for providing the information. I will work on the process by using your walkthrough steps.
10 people are following this question.