Microsoft Azure Virtual Machine Monitoring with Azure Diagnostics Extension

With the launch of the Azure preview portal and the support for the Azure extension model, there are new diagnostic capabilities available that will help you better monitor your Azure IaaS VMs with very little setup and configuration. Azure IaaS monitoring involves collecting and tracking metrics, analyzing log files, defining custom metrics and logging generated by specific applications or workloads running in Virtual Machines. Monitoring will also involve triggering alarms when certain conditions are met, and providing diagnostic data to help in troubleshooting and root cause analysis. Monitoring can help you gain visibility into your running deployments, resource utilization, application performance, operational health and application diagnostics. You can use these insights to react quickly and keep your application running smoothly.

Most of the steps described below can be done directly from the portal. In future, I will add instructions on how to setup and configure monitoring through the SDK API or PowerShell.

 

Note 1: This post covers Windows VMs only. These capabilities aren’t currently supported for Linux Azure VMs, however, we plan to support them in the near future and will add details at that time.

 

Note 2: The capabilities described are only supported on the new Azure portal; which is currently under preview. If you’re logged in to the default portal, you can switch to the new portal by going to the Subscriptions menu as shown below:

 

2014-08-27_17h22_38

 

1. Install the VM Agent upon VM creation

The first step in setting up monitoring on the VM, is to ensure the VM Agent is installed within the VM either at creation time (which is the default configuration) or by updating an existing VM to ensure the VM Agent is running. If you used the default portal to create the VM from the portal, select “Install the VM Agent” as shown below; otherwise skip to step 2:

 

2014-08-27_18h59_46

Upon completion, the VM will automatically have the Azure Diagnostics extension installed and running which will be responsible for collecting your diagnostics data. For more details on all the diagnostic KPIs that Azure Diagnostics supports and how to further configure it to meet your needs, please refer to the MSDN document: Enabling Diagnostics in Azure Cloud Services and Virtual Machines.

 

For additional details about the Azure VM agent and Azure extensions’ use, please reference: Manage Extensions.

 

2. Enable Monitoring:

Diagnostics can be enabled at the VM level. To enable diagnostics, follow the below steps:

  1. Select the VM
  2. Click Monitoring section
  3. Click Settings
  4. Change Status to ON
  5. Click Ok

 

2014-08-27_17h34_21

3. Configure Metrics:

Once you have enabled diagnostics, you can configure it to pick any sub-set or all the available KPIs to track as shown below. To pick KPIs to track, follow these steps:

  1. Select the VM
  2. Click Monitoring section
  3. Click Settings
  4. Diagnostics Frame will open
  5. Select Diagnostics metrics needed
  6. Click Ok

 

2014-08-26_22h59_40

 

4. Accessing Diagnostics Data:

Now that we collected a set of KPIs to track, how do we access this monitoring data?

The portal provides rich charts with any of the metrics collected from the VM. You can also select any custom time range and compare multiple metrics side-by-side. To view the charts follow the below steps:

  1. Select the VM
  2. Under Monitoring section, right click the chart
  3. Select Edit Chart
  4. Select Time Range and list of KPIs to display
  5. See sample below

 

2014-08-27_18h33_57

Since all of the diagnostic data collected was saved in a user storage account that we configured in step 3, we can access it using any of our favorite tools. Below for example, we can use Visual Studio to connect to our monitoring storage account and view the data, I can then export this data to my favorite BI application or Excel and build additional analytics from it. Here are the steps to access the data from Visual Studio:

  1. Go to Server Explorer
  2. Go to Windows Azure Grouping
  3. Go to Storage Grouping
  4. Find the storage account where the monitoring data was configured to be stored
  5. Go to Table: Monitoring data is stored in Azure tables
  6. Double click on associated monitoring table

 

2014-08-28_11h52_41

 

In this post, I have shown how you can take advantage of Azure monitoring infrastructure to enable diagnostics on your Windows VMs running on Azure and how you can get some metrics tracking out of the box from Azure’s new portal in a consistent way as you would be monitoring your other Azure services. In future, we will be providing another post to cover in detail how you can use your existing tools such as SCOM – System Center Operations Manager to monitor your deployed Azure IaaS VMs as well as other supported monitoring scenarios. Until next time!