Virtual Machines Running Time

Padathuvali Joseph 1 Reputation point
2022-11-10T06:15:04.837+00:00

How to get VM Running time(hours) per day over a period of last 30ddays on daily intervals?
Is there any API related to get?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,381 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. srbhatta-MSFT 8,546 Reputation points Microsoft Employee
    2022-11-11T06:28:48.67+00:00

    Hi @Padathuvali Joseph ,
    We get this query quite a lot here on community.
    There is no API to get the VM uptime/running hours directly. However, you can formulate your own Log Analytics Query to query the heartbeat of the VM through Azure Log Analytics Workspace using Azure Monitor, but it might not always be accurate because if in any case the VM agent goes down, then the heartbeat of the VM will not be reported back to the Azure Platform.

    There is an already thread existing on community. You can refer to that below.
    #906519

    Do let me know if this helps. If it doesn't help, please reach back so that I can look into this further :)

    Thanks.

    0 comments No comments