Problem of setting up an alert on azure in the event of a freeze of a VM

Fakri SLIMANE 26 Reputation points


I would like to know how to set up an alert when my VM freezes, to be able to intervene very quickly.


As you can see on the graph, when the VM freezes, there are small dotted lines where you can see that there is no value, probably a communication problem.

here, I would like to create an alert by sending an email when the VM freezes, but I tried and I can't do it because we can't leave the field without value, is there another way to achieve this? to have an alert?



Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,787 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,091 questions
0 comments No comments
{count} votes

Accepted answer
  1. Maxim Sergeev 6,566 Reputation points Microsoft Employee

    For this type of alerts when you are checking missing data, I highly recommend taking aggregation granularity more than in query itself, for example 10 minutes in this case

2 additional answers

Sort by: Most helpful
  1. Maxim Sergeev 6,566 Reputation points Microsoft Employee

    Hi @Fakri SLIMANE ,

    Using VM Insights to capture missing heartbeats is an overkilling approach, if you don't need VM Insights at all.
    Install Azure Monitoring Agent to collect for example several events into Log Analytics Workspace (VM Insights is not required in this case), this will deploy Data Collection Rules with Azure Monitoring Agent. The fact is that you can't collect heartbeats only, so that's why you need to workaround this by collecting some minimum amount of data.

    Then use the query to check missing heartbeats, create an alert rule based on that query

    | summarize LastHeartbeat=max(TimeGenerated) by Computer   
    | where LastHeartbeat < ago(5min)  
    | project Computer, LastHeartbeat, SeverityName_s = "WARNING", AffectedCI_s = strcat(Computer)   

    When your VM is stuck or "frozen", I will receive a notification like that


    2 people found this answer helpful.

  2. kilian goëtz 146 Reputation points


    This tutorial could help you solution is simple, you need VM insight and create a log query.

    "Once you enable monitoring with VM insights in Azure Monitor for the virtual machine, a heartbeat is sent to Azure Monitor every minute. You can create a log query alert rule that sends an alert if a heartbeat isn't detected"

    Kinds regards, Kilian GOËTZ.

    0 comments No comments