Forum Discussion

henry75's avatar
henry75
Copper Contributor
Dec 02, 2022

an alarm when vm has not been on for 30 minutes continuously.

hello, I should create an alarm when vm has not been on for 30 minutes continuously. I know it can be done somehow with heartbeats, but how? and what value I put as Threshold value? pls help me.

2 Replies

  • Clive_Watson's avatar
    Clive_Watson
    Bronze Contributor

    henry75 

    There are 100s of examples in the [Queries] blade in Log Analytics 


    You can search on the Table Name (Heartbeat in this case)

     

    This gives an example 

    // Unavailable computers 
    // List all known computers that didn't send a heartbeat in the last 5 hours. 
    Heartbeat
    | summarize LastHeartbeat=max(TimeGenerated) by Computer
    | where LastHeartbeat < ago(5h)


    Which we can modify:

    // Unavailable computers 
    // List all known computers that didn't send a heartbeat in the last 30 mins. 
    Heartbeat
    | summarize LastHeartbeat=max(TimeGenerated) by Computer
    | where LastHeartbeat < ago(30m)




    Result: