How to Check Uptime of VMware ESXi Host, vCenter and VM

For purposes like troubleshooting, you may want to check uptime of your VMware ESXi host, vCenter or VM. This article summarizes current available ways for you to do this.

Crystal

By Crystal / Updated on July 23, 2024

Share this: instagram reddit

Case: How to check vCenter Uptime?

 

Hi, I'm looking for ways or commands in powershell/powercli to find uptime of my vcenters (windows and appliances based). Thanks.

- Question from communities.vmware.com

VMware ESXi and VMware vCenter Server are 2 key components of vSphere virtualization suite. While ESXi is used to deploy and manage virtual machines, vCenter Server is a centralized platform for managing multiple ESXi hosts and VMs.

After created virtual machines on ESXi, you need to monitor them continuously to ensure that they are running properly, and to avoid errors and unexpected data loss.

Check uptime is a routine operation for monitoring and troubleshooting. If you are not familiar with it, reading this article will help you understand all the basics you need to know.

Check Uptime

Why checking uptime important

Checking uptime is part of the vSphere environment state monitoring. VMware vSphere clusters are extremely good at handling failures in a very non-disruptive way. If a host crashes or goes down for some reason, vSphere HA kicks in and restarts the VM on a different host. You may not even notice it if you do not monitor the environment that notes the downtime of the VMs or the host.

Therefore, the general purposes for check uptime includes:

  • Troubleshooting
  • Diagnose stability issues
  • Maintain a record of maintenance

In addition, monitoring uptime can help catch if someone has rebooted a host or VM without the proper change control in place and proper signoffs, or if someone trying to do something unscrupulous in the environment, such as a rogue administrator installing a rogue VIB and rebooting a host.

That makes check uptime a good way to notice anything odd in the environment that may affect stability. If you want to check VM uptime for purposes like troubleshooting, how should you do that? How to check vCenter uptime or how to check VMware host uptime? This article summarizes the available ways for you.

How to check vCenter uptime via PowerCLI

Since vSphere 6.5, you can check vCenter uptime via the VCSA VAMI. VAMI is the new web-based management interface to perform basic administrative tasks for the appliance configuration. This interface allows to run some tasks via UI instead of using the command line interface.

To check vCenter uptime, you can use the PowerCLI function Get-VAMISummary, for example:

Check vCenter uptime

How to check VMware ESXi host uptime

Since it is a common requirement, there are multiple ways to check your VMware ESXi host uptime in a vSphere environment. For example, it is displayed in vSphere Client along with many other useful information about your ESXi host.

This part summarizes 3 available ways for checking VMware host uptime.

Way 1. How to check VMware ESXi host uptime in vSphere Client

Access and log in vSphere Client, the uptime information is displayed on the ESXi host Summary tab.

vSphere Client check host uptime

Way 2. How to check ESXi host uptime via ESXi CLI

SSH to the host with root credentials. And run the command uptime to get the uptime of your ESXi host including days, hours, minutes, and seconds.

ESXi CLI check host uptime

Way 3. How to check VMware ESXi host uptime via VMware PowerCLI

Checking VMware host uptime via VMware PowerCLI commands is perhaps the most powerful way. Using PowerCLI, you can not only check the uptime of a single host, but also check an entire environment if you want. The returned information can be exported to a CSV or manipulated in other ways.

To the get uptime in days, you can use the following:

Get-VMHost | Select Name,
@{N="Uptime"; E={New-Timespan -Start $_.ExtensionData.Summary.Runtime.BootTime -End (Get-Date) | Select -ExpandProperty Days}}

To get the specific last boot time along with the uptime, you can use the following code snippet:

Get-Vmhost | sort-object Name | Select-Object Name,
@{N="Last Boot (UTC)";E={$_.ExtensionData.Summary.Runtime.BootTime}},

@{N="Last Boot (Locale)";E={Convert-UTCtoLocal -UTCTime $_.ExtensionData.Sumary.Runtime.BootTime}},

@{N="Uptime (Locale)";E={getTimeSpanFormatted((Get-Date) - (Convert-UTCtoLocal -UTCTime $_ExtensionData.Summary.Runtime.BootTime))}}

You can use the Export-CSV to export the results to a CSV file to pull into Excel or some other tool.

How to check VM uptime in vCenter

Windows offers the Get-Uptime cmdlet to get the time elapsed since the last reboot of a server. The obvious advantage of this cmdlet is that you don’t have to calculate anything since it directly gives your server’s uptime as the output. Let's check virtual machine uptime in vCenter.

This cmdlet takes two parameters, namely:

Get-Uptime
[-Since]
[]

The [-Since] cmdlet returns a DateTime object to give you the server’s last restart date and time. If you use the cmdlet without any parameters, it only returns the uptime.

For example, if you run Get-Uptime, you will get the output like:

Get-Uptime

Days : 9
Hours : 0
Minutes : 9
Seconds : 45
Milliseconds : 0
Ticks : 7781850000000
TotalDays : 9.00677083333333
TotalHours : 216.1625
TotalMinutes : 12969.75
TotalSeconds : 778185
TotalMilliseconds : 778185000

If you run Get-Uptime -Since, the output will be like:

Get-Uptime -Since

Tuesday, June 18, 2019 2:34:56 PM

Also, there’s a Get-VMUptime function. The simplest form to call the Get-VMUptime function would be like:

$vm = Get-VM MyVM
Get-VMUptime -VM $vm

This will return 1 object with the Uptime property showing the percentage.

Get-VMUptime

Checking VM uptime in vCenter environment is crucial for maintaining system reliability and performance. By regularly checking uptime, IT teams can ensure that VMs are operating as expected, identify potential issues before they escalate. However, even with diligent monitoring, unexpected failures can occur, making data backup a vital component of a robust IT strategy.

All In One: Schedule VMware ESXi VMs backup

If an ESXi host or virtual machine fails, it can endanger data and pose a serious threat to enterprise security. Beyond uptime checks, it's equally important to maintain a reliable virtual machine backup.

Here I introduce you AOMEI Cyber Backup as a professional VMware backup software. It seamlessly integrates with vCenter, allowing users to directly add and manage multiple ESXi hosts and virtual machines from a single interface. This streamlined process eliminates the need for installing agents, simplifying the backup and recovery operations.

Agentless VM Backup: Create complete and independent image-level backup for VMware ESXi and Hyper-V VMs.
Grow with vCenter environment: As your business expands, easily scale to accommodate additional hosts, virtual machines, and physical servers without compromising on performance.
Flexible Storage Destinations: Store backups to local drive, network location or cloud storage.
Centralized Management: Centrally backup and restore virtual machines from a user-friendly interface.

AOMEI Cyber Backup

✨Its comprehensive features cater to both virtual and physical environments, making it an ideal solution for enterprises seeking efficient and reliable data backup and recovery. You can click the following button to download the 30-day free trial.

Download Free TrialVMware ESXi & Hyper-V
Secure Download

*You can choose to install this VM backup software on either Windows or Linux system.

Create auto backup for multiple VMs in vCenter Server only 4 easy steps

Implementing the reliable backup solutions provided by AOMEI Cyber Backup ensures that critical data is protected and can be quickly restored in the event of a VM failure.

Next, I will show you how to perform VMware ESXi VM backup and recovery via AOMEI Cyber Backup.

1. Bind Devices: Access to AOMEI Cyber Backup web client, navigate to Source Device > VMware > + Add VMware Device to Add vCenter or Standalone ESXi host. And then click > Bind Device.

Add VMware ESXi host

2. Create Backup Task: Navigate to Backup Task > + Create New Task, and then set Task Name, Backup Type, Device, Target, and Schedule.

  • Task Name: you can change the task name or use the default name with an ordinal.
  • Device: batch select large numbers of VMs managed by vCenter Server for centralized backup.

Select virtual machines vCenter

  • Target: select to back up to a local path, or to a network path.
  • Schedule (optional): perform full, differential, or incremental backup, and automate execution according to the frequency you specified.

Backup schedule type

  • Cleanup (optional): automatically delete the old backup copies that exceed the retention period you specified.

backup cleanup

3. Run Backup: Click Start Backup and select Add the schedule and start backup now, or Add the schedule only.

Start Backup

Created backup tasks will be listed and monitored separately, for restoring, progress checking and schedule changing.

4. Restore: When restoring, you can also restore to new location to create a new VM in the same or another datastore/host directly from the backup, saving the trouble of re-configuring the new VM.

Restore to new location

By following the steps above, AOMEI Cyber Backup helps safeguard your VMware ESXi VMs against data loss and minimize operational disruptions.

Summary

Checking uptime is one of the effective ways to monitor the state of your vSphere environment. It can help you troubleshoot errors, diagnose stability issues, or keep a record of maintenance. If you want to know how to check VMware host uptime, or check vCenter uptime, check VM uptime, this article summarized several available ways to do this.

Except for check uptime, backup and restore is also a reliable way to protect your VM data from disasters. You can try AOMEI Cyber Backup, a VMware backup software that enables you to create backup tasks cover multiple VMs, and automate the VM protection.

Crystal
Crystal · Editor
Crystal is an editor from AOMEI Technology. She mainly writes articles about virtual machine. She is a positive young lady likes to share articles with peolpe. Off work she loves travelling and cooking which is wonderful for life.