Adding Extended Metrics for Virtual Machines

Why should you ensure that all your VMs have their monitoring diagnostics metrics enabled?

 

This helps you to:

  • monitor the health of your VMs
  • know when your VMs are reaching their memory, disk, CPU upper limits
  • detect usage trends and anomalies
  • set alert rules based on lower or upper thresholds
  • control your costs by sizing according to required usage
  • get cost effective sizing optimization recommendations from Cloudyn

 

Let's say you want to monitor the CPU % and Memory % of your Azure VMs.

These correspond to: "[Host] Percentage CPU" and "Memory percentage" / "Mem. percent available".

 

It should be easy within the Azure Portal to:

  • create a graph containing these metrics for any of your Virtual machines, or
  • set Alert rules on these metrics

 

Unfortunately, it is common for some or all of these metrics not be unavailable, due to incorrect configuration.

 

Try the following steps to determine the available metrics:

Under "Virtual machines", select a VM,  click Monitoring "Metrics". You should see a checkbox list including the above metrics.

Under "Virtual machines (classic)", select a VM, clicking "Overview", select the default graph containing "CPU Percentage". Clicking "Edit" should the above metrics


If you have VMs where these metrics are not available to be chosen, then follow the steps below.

 

Automate enabling diagnostics on your VMs

To automate enabling diagnostics on your VM, you can use the utility available at https://github.com/Cloudyn/azure-enable-diagnostics

 

Understanding the changes required

Enable these types of metrics requires the following steps:

  • Register "Microsoft.Insights" Resource provider on all subscriptions.
  • For each VM, enable diagnostics settings, specify a storage account, and check "Basic metrics"

There are "Standard metrics" (ie Host metrics), eg "[Host] Percentage CPU".

There are "Basic metrics" (ie Extended metrics), eg  "Memory percentage" / "Mem. percent available".

If "Microsoft.Insights" is not registered, then Standard metrics would not be available for Classic VMs (and in some cases, “Resource Manager” VMs), and Extended metrics would not be available for any VMs. This would result in an error such as:

 

 

If diagnostics settings is not configured for a VM (but "Microsoft.Insights is enabled" for classic VMs), then only Standard metrics would be available.

 

Extended metrics is only available if both "Microsoft.Insights" is registered, and diagnostics settings are configured:

 

 

 

Manually enable diagnostics on your VMs

 

The following shows the manual steps for enabling diagnostic metrics.

In the Azure Portal, click on the user icon at the top right and select "My Permissions"



Select "Resource Provider Status"


 

For each Azure Subscription, Search for "Microsoft.Insights". If it is not registered, then click "Register".


 

Configuration per VM

 

Select "Virtual Machine" or "Virtual Machine (classic)". Select "Diagnostics settings" (or "Diagnostics"). Enable the Status, choose a Storage account, and select "Basic Metrics".

For Windows machines:

 

For linux machines:

 

Setting up diagnostics for new VMs

When creating a new VM, after you selected the Azure Resource Manager from the deployment model drop-down and configured the basic settings, you need to ensure that the monitoring option is enabled and that you have selected a storage account where you would like to place these diagnostic files.



 

 

Now that all is set in the Azure side, make sure you have updated your ARM credentials in Cloudyn. This will allow us to collect and display performance data for your machines and take it into considertaion in our optimization recommendations.

Please allow Cloudyn approximately 10 days of data collection, once above updates are implemented, so that the system can run the optimization algorithm and provide relevant recommendations.


Update an Existing Virtual Machine

You can also update an existing ARM based Virtual Machine through the Portal to enable diagnostics. Navigate to your VM and select “Diagnostics” (1) in the settings blade. Enable the Status (2) and select the Basic Metrics (3) and save your settings. Make sure you have a storage account set in order to save the monitoring logs.

Remember that you must restart the VM for the changes to take effect.



Viewing Azure Performance Metrics

To view performance metrics on your Azure Instances, select the instance in "Instance Explorer", expand the relevant line and click on CPU and/or Memory
When searching for instances within "Instance Explorer", note that the "ProviderNamespace" column can be used to distinguish between Classic and Resource Manager instances.