Quantcast
Channel: VMware Communities: Message List - ESXi
Viewing all articles
Browse latest Browse all 28826

Re: VM uptime

$
0
0

OK, so you're using putty to connect to the ESXi host and then you want to run a command line option from the ESXi host shell to enumerate a specific VM's uptime?

 

You'll have to do some tinkering to script it further, but you could get it with this

 

[root@hwlesxi07:/bin] vim-cmd vmsvc/getallvms | grep hwlvra7201

320    hwlvra7201                                                                         [NFS-01] hwlvra7201/hwlvra7201.vmx                                                                                                                                               sles11_64Guest          vmx-07    VMware vRealize Automation enables customized, self-service provisioning and lifecycle management of cloud services that comply with established business policies.                                                                                                                                                                                                                                                                                                                                                                                            

[root@hwlesxi07:/bin] vim-cmd vmsvc/get.runtime 320 | grep bootTime

   bootTime = "2017-11-17T19:51:37.503343Z",

 

You would have to parse the vmID from the first command ("320" in the example) and use it in the second command.  Parse the boot time value and subtract it from todays date to get total uptime.

 

I don't know of any way to get a scalar value for uptime (i.e. seconds, days, etc.) of a VM from the host command line unless I missed a value somewhere in the vim-cmd vmsvc/ namespace.  You can play with the commands in there to see what might be of value to you.


Viewing all articles
Browse latest Browse all 28826

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>