Monitor and Analyze Azure Resources with Azure Monitor and Log Analytics (Real time examples with few Use Cases)

Dear friends, ensuring your application workloads and data are secure is essential, but it is not enough. Monitoring play an important role for any infrastructure. For IaaS workloads, Azure Monitoring play a very important role and this require ‘s almost similar effort what you need to monitor your on premises infrastructure.

We need continuous monitoring and analysis to ensure performance and stability aren’t negatively impacted by poor network connections or server issues. Here are the three important criteria you should keep in your mind while understanding the need of monitoring the Azure infrastructure.

  • Getting insight into the health of your VMs
  • Correlating and mapping VM dependencies
  • Monitoring and troubleshooting applications

Capabilities or components which can be used for monitoring of the Azure resources are as follows.

  • Azure Monitor
  • Azure Log Analytics
  • Azure Application Insights
  • Service Map

In today’s post I will discuss about Azure Monitor and show few use cases. The last use case is related to Azure Log Analytics.

What is Azure Monitor?

Azure Monitor collects host-level metrics like CPU, disk, and network usage for all virtual machines without the need to install or configure any additional agents. With Azure Monitor, you can visualize, query, route, archive, and take action on the metrics and logs coming from resources in Azure.

For more insight into a virtual machine, you can collect guest-level metrics, logs, and other diagnostic data using the Azure Diagnostics agent. You can also send diagnostic data to other services like Application Insights.

Now let’s see few use cases where I have used Azure Monitor, these use cases are very simple and used only for the demo purpose. In real production environment you may need to work with many other metrics based on your requirement.

Use Case 1: We need to know whether any D-DOS attack recently happened in a public gateway IP.

Please go to Monitor-Metrics tab

Select the resource group and select the IP address of the VM

Select under DDoS attack or not

For this particular VM above we haven’t see any DDoS attack.

Use Case 2: We will check what the incoming bandwidth in a VM network is.

Again we will go to monitor metrics tab.

We will select the VM and select the metric Network In

You can also export the data in excel to examine it at a later time. The excel file will look like this.

Use Case 3: Monitor Activity Log

This below screenshot will show us how to monitor each operations in all the resource group.

Use Case 4: Enable diagnostics and guest-level monitoring.

This use case will show how to enable guest-level monitoring of Azure VM’s

On the VM blade go to monitoring and click on the diagnostics settings.

Use case 5: Use Log Search to chart average free memory reported for each instances every hour

This a sample taken from Azure Log Analytics, you can open Log Analytics from Azure Services as shown below

Go to Log Search

In the log search run this query.

This is a sample query to chart average free memory reported for each instances every hour.


| where CounterName == “Free Megabytes”

| summarize avg(CounterValue) by bin(TimeGenerated, 1h), InstanceName

| render timechart

If you want to know more on how to write analytics query you can refer the query language cheat sheet here.

Conclusion: For the existing infrastructure monitoring folks who were thinking that their jobs are at risks due to massive workloads moving to Azure, I think this is a wrong thinking, Azure gives us many new ways to monitor the infrastructure and the manual effort to monitor the infrastructure will be always there. What we need to do is to learn all the aspect of monitoring in the Azure cloud so that we can get the best out of monitoring. I will write more posts on Azure Monitoring and Log Analytics in future. Stay tuned. Wish you a great day/night ahead.