VMware Cloud Community
Marcus316
Enthusiast
Enthusiast

PowerCLI script for vSphere capacity planning

Hello everyone!

After recent discussion on vSphere Capacity planning, I thought I would share one of the tools I use for this purpose. This is a side project I've been working on for few months.

I present to you, my very own "VMware Capacity & Performance Report PowerCLI script (v2.1 Community edition)"

http://1drv.ms/1J00vkq

(Click here then click on "Download")

This is a complex PowerCLI script I wrote, that generates an e-mail report that gives you insight into the current state of your VMware vSphere environment's capacity. It generates tables, pie charts and line charts with information about CPU, Memory & Storage capacity, VM Provisioning Potential, Cluster Resilience and more. Check the script's #INFORMATION block for more information about prerequisites, script input and output.

Have a look at the report it generates and let me know what you think of it!

Please share your thoughts and comments!

Marc Davoli

http://ca.linkedin.com/in/marcvincentdavoli/

Edited on May 25 : Changed OneDrive link to updated script v2.1 with bugfix (for cluster names with a space in it)

160 Replies
YuvarajSekar01
Enthusiast
Enthusiast

Hi, I don't understand this stats.. What is the CPU slots available? Number seems to be unrealistic. Considering the environmental has 3 host with version 6 ESXI.

Thanks in Advance.

Yuvaraj

Reply
0 Kudos
vikas_bhatt
Contributor
Contributor

Hi ,

First of all thanks,This Script is awesome.It was working well till few days back but now it is not showing any value in the Monthly Average CPU Usage %,thus graphs is also empty.Monthly Average Memory Usage %.JPG

I checked all things but in vain.

Pls help

Same is with Monthly Average Memory Usage% but Datastore capacity report is showing fine in tabular as well as in graphs.

regards

Vikas Bhatt

Reply
0 Kudos
YuvarajSekar01
Enthusiast
Enthusiast

Hi Frostky,

I am unable to connect to Vcenter. When i run this script i am getting report in the mail but without any data. Can you please help me. Suddenly facing this issue.

Thanks,

Reply
0 Kudos
YuvarajSekar01
Enthusiast
Enthusiast

I am getting error like -- the term 'Connect VIServer' is not recognized.  

Reply
0 Kudos
frostyk
Enthusiast
Enthusiast

It will do that if you haven't loaded the PowerCLI modules in your session.  I think this script is older and uses the old method of loading them so you'll need to run this before the script or put it at the top:

Import-module VMware.VimAutomation.Core

Or just run it from the PowerCLI shortcut that's on your desktop after installing powercli (it loads them automatically).  Also make sure you are running this on a system where you have installed powercli.

YuvarajSekar01
Enthusiast
Enthusiast

Thanks man.. its working fine to me now.

Reply
0 Kudos
YuvarajSekar01
Enthusiast
Enthusiast

Hi,

This script is able to capture data on the Linux, Unix and Windows OS details. How about to capture for the CentOS,Oracle, Applicance servers etc,

Also, I want to include the license details on utilized/Available license of the VM in the Vcenter in the output file. And, if possible cluster commitment.Over commitment details also looking forward

Thanks in advance

Reply
0 Kudos
YuvarajSekar01
Enthusiast
Enthusiast

LucDfrostyk

Hi All,

In Output, Under vCenter Inventory, I am getting 3:1 Consolidation ratio. what is he trying to explain?

Thanks in Advance,

Reply
0 Kudos
LucD
Leadership
Leadership

The consolidation ratio is the number of VMs/the number of VMHosts.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

jak1975
Contributor
Contributor

I'm unable to download the v2.1 script. The link to OneDrive doesn't work.

Reply
0 Kudos
LucD
Leadership
Leadership

The complete script is available inline, a couple of replies back in this thread.
108.  Re: PowerCLI script for vSphere capacity planning


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
2K
Contributor
Contributor

Great Script for VMware and VSphere reporting. As we use not only VMware, but also Hyper-V in our environment.

I was wondering if anyone had tried to do take the same script to use in Hyper-V for reporting cluster and VM stats?

Reply
0 Kudos
imkarter
Contributor
Contributor

Hello Marc,

Thanks for this script. I am new to both vmware and scripting. Getting the below error for CPU, memory and all stats gathering. Can you please help?

Cannot convert value "<td>" to type "System.Int32". Error: "Input string was

not in a correct format."

At C:\Users\kkannan1_l4\Desktop\check1.ps1:492 char:3

+   + "<td>" + (GetDatastoreAllocationPercentage $_) + "% </tr>"

+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException

    + FullyQualifiedErrorId : InvalidCastFromStringToInteger

Almost at all data collection lines. Moreover, can you tell me how long the script takes complete the entire procedure?

Reply
0 Kudos
LucD
Leadership
Leadership

You will need to provide a bit more info.
How and from where do you run the script?

Are you connected to a vCenter?

Which PowerCLI version are you using?

A screenshot of the first few lines of a run you did would alreayd help.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

rtjohns1
Contributor
Contributor

I recently updated to PowerCLI v. 6.5 and not the script won't work.  I have imported the VMWare.VimAutomation.Core module, but I keep getting errors and empty reports.  Has anyone used the script successfully using PowerCLI v6.5?

Reply
0 Kudos
digitalktechltd
Contributor
Contributor

Brilliant - thanks for the effort you have put in - this is a task faced by may sysadmins alike, so just thank you for saving time!

UberGeek1
Enthusiast
Enthusiast

This is a bit older of a thread but I figured I would throw my 2 cents in.

What I ended up doing is creating a new VIProperty on the Cluster object that did all of this and presented it as part of the Cluster object, so I could do a Get-Cluster and have the capacity info there, updated in real-time, whenever I wanted it.  This is handy to check capacity before deploying a new VM.  Now this does add a couple of seconds to large clusters, but my 61 host cluster takes about 2 seconds to gather all the information required.

The other reason I do this is because we use a custom algorithm to calculate capacity, and having it built in this way and always available helps to have the data available whenever we need it.

Sincerely, Jody L. Whitlock
Reply
0 Kudos
noor1027
Contributor
Contributor

hi,

we need v2.1 script. the link is still pointing to v2.0.

secondly it is not working with vcenter appliance 6.5

noor
Reply
0 Kudos
mibiras
Contributor
Contributor

Hello

Is possible to add to this report also section with Datastore Cluster Capacity Report (output from Get-DatastoreCluster) with same columns as have Datastore Capacity Report?

Thanks

Reply
0 Kudos
DazK
Contributor
Contributor

Hi,

Script has been working fine for me for years now, however oddly after some Infrastructure refresh changes we have 2 new Clusters (PR/DR) when running the report on the PR side everything still perfect but when running the script on the DR side it keeps reporting on both Clusters, Hosts Data-stores etc all in the 1 report even though I am only specifying the DR VCenter name in the report, I take it there is a permission or something somewhere on the DR side that is making the report look at both clusters but does anyone know where to check or how i can get the report just reporting on the 1 vcenter like it does for the PR ?

Thanks

Reply
0 Kudos