Finding VM runtime in azure portal

Vinoth Kaliaperumal 386 Reputation points
2023-03-01T07:12:11.5966667+00:00

How to find the overall runtime of an azure virtual machine via portal/log analytic workspace?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,013 questions
{count} votes

Accepted answer
  1. Tech-Hyd-1989 5,816 Reputation points
    2023-03-01T10:14:36.94+00:00

    Hello Vinoth Kaliaperumal

    To find the overall runtime of an Azure virtual machine via portal or Log Analytics workspace, you can follow the below steps:

    Option 1: Using Azure Portal

    1. Open the Azure Portal and navigate to your virtual machine.
    2. Under the "Monitoring" section, click on "Metrics" to open the metrics dashboard.
    3. In the "Metrics" blade, select the "Percentage CPU" metric and set the time range to the desired period.
    4. The graph will display the percentage of CPU usage over the selected period. The runtime of the virtual machine can be estimated by looking at the periods where the CPU usage is consistently high.

    Option 2: Using Log Analytics Workspace

    1. Open the Azure Portal and navigate to your Log Analytics workspace.
    2. Click on "Logs" in the left-hand menu to open the Log Analytics query editor.
    3. Use the following query to get the overall runtime of the virtual machine: User's image Replace <virtual machine name> with the name of the virtual machine you want to check.
    4. The query will return the overall runtime of the virtual machine in seconds. You can convert the output to minutes or hours as needed. Note: The "Heartbeat" table contains a record of every time a virtual machine sends a heartbeat to the Azure Monitor service. The "TimeGenerated" column indicates the time when the heartbeat was received. By subtracting the minimum and maximum values of the "TimeGenerated" column, we can determine the overall runtime of the virtual machine.

    If this does answer your question, please feel free to mark it as the answer as a token of appreciation.

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.