pythonazureazure-sdk-python

How to get Azure VM uptime/runtime (time in running status) with Azure Python SDK


Is it any way to get how long time a Azure VM have been in running status (uptime/runtime) with use of the Azure Python SDK?

A code example would be verry helpfull. Or any hint om where I should look to find out how to do this.

Br. Rune


Solution

  • As I known, there is not an existing API to get the uptime value using Azure Python SDK for Azure VM. There is a feedback about uptime which you can follow up for this feature.

    Per my experience, a workaround way is that you can install some third-party libraries like uptime in Python on Azure VM to get the system uptime value to publish it via HTTP or sending to other Azure stores on schedule, then you can call or retrieve to get it when you need.

    Hope it helps.