How do I create an alert for when a VM is stopped?

Jason Benci 1 Reputation point
2022-03-10T17:32:12.067+00:00

How do I create an alert for when a VM is stopped? I can't seem to find the right criteria when creating a new alert rule.

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,798 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,111 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Jasjit Chopra 6 Reputation points MVP
    2022-03-10T17:55:54.037+00:00

    It is under "Activity Log"

    181985-power-off-vm.jpg

    Hope this helps !


  2. Sudipta Chakraborty - MSFT 1,096 Reputation points Microsoft Employee
    2022-03-10T17:55:59.37+00:00

    To send an alert when a machine is unavailable. It could be stopped, the guest operating system could be unresponsive, or the agent could be unresponsive. There are various ways to configure this alerting, but the most common is to use the heartbeat sent from the Log Analytics agent.

    Query:

    Heartbeat  
    | summarize LastHeartbeat=max(TimeGenerated) by Computer   
    | where LastHeartbeat < ago(5m)  
    

    Reference:
    https://learn.microsoft.com/en-us/azure/azure-monitor/vm/monitor-virtual-machine-alerts#machine-unavailable

    Setting up alert using Log Analytics Query:
    https://devblogs.microsoft.com/premier-developer/alerts-based-on-analytics-query-using-custom-log-search/

    0 comments No comments