Forum Discussion

ljm2022's avatar
ljm2022
Copper Contributor
Feb 25, 2024

Monitor a Hybrid computer shutdown in Azure Arc

Hi, 

 

I have created this alert to monitor when a Hybrid computer I have in Azure Arc is down. The computer is running but I am receiving emails. The query is not returning any values. I tried setting the threshold value to 1 but it did not work.

Thank you!

 

 

 

 

3 Replies

  • If your intention is to alert when an Arc-enabled machine stops reporting, I would base the rule on missing Azure Monitor Agent heartbeat data, rather than interpreting an empty query result as an error by itself.

     

    First verify that the machine currently sends heartbeat records:

     

    Heartbeat

    | where Category == "Azure Monitor Agent"

    | where Computer == "<computer-name>"

    | order by TimeGenerated desc

    | take 10

     

    Microsoft recommends this exact type of heartbeat check when troubleshooting AMA on Arc-enabled servers.

     

    For the alert you could use:

     

    Heartbeat

    | where TimeGenerated > ago(24h)

    | where Category == "Azure Monitor Agent"

    | where Computer == "<computer-name>"

    | summarize LastHeartbeat=max(TimeGenerated)

    | extend MinutesSinceLastHeartbeat =

    datetime_diff("minute", now(), LastHeartbeat)

    | where MinutesSinceLastHeartbeat > 10

     

    Then configure the alert to trigger when number of results > 0.

     

    Heartbeat records are normally generated regularly and Microsoft's sample queries also use the last received heartbeat to establish agent availability.

     

    One important distinction: this detects loss of monitoring connectivity, which could mean shutdown, network failure or AMA failure. It doesn't by itself prove the operating system was intentionally shut down.

  • Hamza1's avatar
    Hamza1
    Copper Contributor

    I’ve seen this happen with Azure Arc alerts. If the query isn’t returning any values, I’d first check whether the Arc machine is actually sending the expected heartbeat data to the Log Analytics workspace. Also make sure the alert query is looking at the correct table and that the time window matches your alert evaluation period. A missing heartbeat is usually easier to monitor than the machine’s actual shutdown state.