The following is a guest post by John Matson, a content developer at Datadog, which allows users to view metrics from all of their apps, tools and services in one place with their cloud monitoring as a service solution. This post is Part 2 of a three-part series on monitoring Azure Virtual Machines. Part 1 explores the key metrics available in Azure.
How you go about capturing and monitoring Azure metrics depends on your use case and the scale of your infrastructure. The two easiest ways to access metrics from Azure VMs are by using the Azure web portal or by using a monitoring service such as Datadog that integrates directly with Azure to gather metrics from your VMs. The Azure Portal provides VM metrics at one-minute intervals; Datadog collects those metrics and also pulls in additional system and application metrics at higher resolution.
Viewing Metrics in the Azure Web Portal
The Azure web portal has built-in monitoring functionality for viewing and alerting on performance metrics. You can graph any of the metrics available in Azure and set simple alert rules to send email notifications when metrics exceed minimum or maximum thresholds.
Enabling Azure VM Monitoring
Azure's Diagnostics extension can be enabled when you create a new virtual machine via the Azure web portal. But even if you disabled diagnostics when creating a VM, you can turn it on later from the "Settings" menu in the VM view. You can select which metrics you wish to collect (basic metrics, network and web metrics, .NET metrics, etc.) in the Diagnostics tile as well. You will have to link the VM to an Azure storage account to store your diagnostics data. If you plan to use Datadog for Azure VM monitoring, you will need to enable diagnostics as well.
Note that portal users can create VMs using two different deployment models ("Classic" and "Resource Manager"). At present, some monitoring functionality is only available via the Classic deployment model.
Viewing Metrics in the Web Portal
Once monitoring is enabled, you will see several default metric graphs when you click on your VM in the Azure portal.
Clicking on any monitoring graph opens a larger view, along with two important settings options: "Edit chart," which allows you to select the metrics and the timeframe displayed on that graph; and "Add alert," which opens the Azure alerting tile.
Adding Alert Rules
In the alerting tile you can set alerts on Azure VM metrics using fixed thresholds. Azure alerts can be set against any upper or lower threshold and will alert whenever the selected metric exceeds (or falls below) that threshold for a set amount of time. In the example below, we have set an alert that will notify us by email whenever the CPU usage on the given virtual machine exceeds 90 percent over a 10-minute interval.
Azure deployments can also be integrated with standalone monitoring systems for more sophisticated alerting functionality. Datadog users can set alerts not only on fixed thresholds but on anomalous rates of change or using automated outlier detection to spot rogue servers.
In this post we have demonstrated how to use Azure's built-in monitoring functionality to graph VM metrics and generate alerts when those metrics go out of bounds.
At Datadog, we have integrated directly with Azure so that you can begin collecting and monitoring VM metrics with a minimum of setup. Learn how Datadog can help you to monitor Azure in the next and final post of this series.