vsphere-automation-sdk-python icon indicating copy to clipboard operation
vsphere-automation-sdk-python copied to clipboard

Get VM uptime/last reboot

Open Elinoy-1 opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe.

It's not related to a problem, but I'm trying to retrieve more information regarding each VM.

Describe the solution you'd like

I'm retrieving a list of all of my VMs based on the vSphere client and the following queries: sphere_client.vcenter.vm.guest.Identity.get(vm=vm) and vsphere_client.vcenter.VM.list(vm_filter) I'd like to also add also information regarding uptime/last reboot time per VM, is it possible?

Thank you

Describe alternatives you've considered

No response

Additional context

No response

Elinoy-1 avatar Jan 16 '22 11:01 Elinoy-1

Same, I'm looking at all the available counters in the vStats api, and none of them have last boot time, or sys.uptime for VMs. Anyone at VMware know how to get this counter/metric? The REST api for v7.x is not well documented on the website. I spent considerable time in apiexplorer as well. I can list all VM info just fine except for this one metric (uptime).

SimSama avatar Sep 08 '22 23:09 SimSama

There is bootTime property in VirtualMachineRuntimeInfo(vim.vm.RuntimeInfo) in SOAP API (via PyVmomi SDK). You can find more details in, https://developer.vmware.com/apis/1192/vsphere (Search for VirtualMachineRuntimeInfo)

VirtualMachineRuntimeInfo is not yet available in REST.

jobingeo avatar Sep 09 '22 02:09 jobingeo

Thanks for this, I spent an untold number of hours scouring the REST api thinking "surely its in here somewhere, they wouldn't just leave the most basic useful metric out.".

I'll check out the SOAP SDK now.

SimSama avatar Sep 09 '22 04:09 SimSama