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
Problem of setting up an alert on azure in the event of a freeze of a VM
Hello,
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?
Cordially,
Fakri
-
Maxim Sergeev 6,566 Reputation points Microsoft Employee
2022-09-06T23:47:26.627+00:00
2 additional answers
Sort by: Most helpful
-
Maxim Sergeev 6,566 Reputation points Microsoft Employee
2022-09-05T19:11:35.93+00:00 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
Heartbeat | 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
-
kilian goëtz 146 Reputation points
2022-09-05T16:32:58.967+00:00 Hello,
This tutorial could help you https://learn.microsoft.com/en-us/azure/azure-monitor/vm/tutorial-monitor-vm-alert 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.