vSphere Capacity Report
Purpose of the Script:
If you are an admin who manages a vSphere environment then you are in the right place. How many times did you wish for a report that would give you a holistic view of capacity of your environment? Well, I know you can get that from vRealize Operations Manager, but what about a simple script which can give you similar information but in more compact form. Imagine logging in to your system in the morning and opening a HTML report which gives you at a glance information of your environment. This script does exactly that.
What exactly does it do?
This is a script which generates a HTML report on overall capacity of a vSphere environment. For example, it can tell you what is the total available physical cores in your environment. What is the allocated vCPU and Used vCPU in your environment. Similar information for memory of the environment is also available. It will also tell you the total number of VM's in the environment. At the end it gives you view of all the datastores.
The script gives you a close approximation of the resources, since it does not calculate the memory overhead of the VM's or memory required by the hypervisor, so it is not an exact value, but would give you fair idea about your environment capacity.
The best part of this script is, it breaks down the information from overall capacity to Cluster level to Host level. So that you can get a fair idea of the environment.
How does it work?
This is a plain PowerShell script which you can run manually or schedule it in Windows Scheduler. There is a single script Get-Capacity.ps1 which when run will generate the report for the environment. To run the script, follow the following format:Β
Get-Capacity -vcenter -vcuser -vcpassword -consolidation
Note the Consolidation parameter. Depending on the number of available physical cores, the script calculates Available vCPU count. This count is generated based on the CPU consolidation ratio that you want for your environment.
Sample Output:
A sample output is shown below.
Areas of Improvement:
This is the first cut of the script and I plan to improve the following areas.
- Create a front end form where users will be able to choose the Clusters on which the Capacity test will be done
- Create separate functions for calculating capacity at different layers
- Create separate function to get the HTML output
- Create more proper Verbose and Debug output
- Create more detailed logging
- Take input from credential file
Also I plan to collaborate with my reader and take inputs for them. This script is more of educational value than practical value. So I want my readers to work on this and provide suggestions.
Where to get it?
You can download the main script as well as the sample HTML file from the GitHub repository atΒ https://github.com/sajaldebnath/vsphere-capacity-reportΒ .
So let's start!!!!!!!!!!!!!!
Β