In order to monitor the VMware snapshots, you could get the snapshot report from vCenter automatically, which helps in monitor the space usage and VM performance.
VMware Snapshot is similar to a rolling back point used to restore a VM to a specific state at a specific point in time, which is particularly useful after a failure or system error. You can schedule snapshots to protect your virtual machine. However, the size of snapshots is growing rapidly, even can grow beyond the original disk file size. To avoid time-wasting and running out of disk space, you need to find and delete the snapshots timely, especially for those that occupied large space and no longer needed. This is a costly operation, which significantly reduces the performance of the virtual machine.
So this article will help you to monitor your VM performance and introduce how to get snapshot report from vCenter.
VMware allows you to export VMware snapshot manually. In this case, I needed to get the name of the VM, the snapshot description, snapshot size, date created and the username of whom created it.
Firstly, you’re going to want to make sure that you have downloaded and installed the PowerCLI module. Our task is to create and set up an automated snapshot report for all our virtual machines hosted in our VMware environment which would run daily. Here, I will use PowerShell and specifically, the VMware PowerCLI module to achieve this. Now we can begin writing our script.
To report snapshots of all the virtual machines in your VMWare environment with PowerCLI:
1. Import the PowerCLI module and then setup our connection to vCenter.
2. Store the password in a text file using the ConvertFrom-SecureString to turn convert it to an encrypted format which cannot be easily read.
Tips: You don’t want to set an automated task, you could avoid this step.
3. Set credentials and connect to the VMware host or vCenter server.
4. Use Get-VM command to list all of snapshots
However, unfortunately, the above command is unable to get the username of who created each snapshot. So, to create the snapshot report as an HTML document.
This sets up the start of the HTML document and the header. I have opted to use a second variable to store the CSS styling for the report. It then adds the start of the table for the report it’s headings.
This will create a new line for each snapshot and add in the values for the various pieces of data which I want to report on.
5. Finally, once we have all the data, we can close out the table, HTML and disconnect from the vCenter server.
The final line of this script then exports the report to an HTML file.
Getting snapshot report helps to monitor VMware snapshot and prevent virtual machine running out of space. As we know, snapshots is commonly used to restore a virtual machine to a specific state. However, excessive VMware snapshots could degrade VM performance and could not be used as VMware backup solution to secure virtual machine data.
In order to manage VM snapshots, you could create a snapshot report from vCenter that includes the name of the VM, the snapshot description, snapshot size, date created and the username of whom created it.
This article offers you the detailed steps on how to get snapshot report from vCenter.