VMware

getNumofvCPUInCluster.pl

VERSION 2 Published

Created on: Aug 18, 2009 4:07 PM by lamw - Last Modified:  Aug 19, 2009 4:56 PM by lamw

While waiting for VUM to finish up on some new vSphere ESX 4.0 hosts, I was reading VMTN blogs and noticed this interesting article by Jason Boche: http://www.boche.net/blog/index.php/2009/08/18/hidden-virtual-cpu-limit-restriction-in-esx-3-5/

This script will query a specific cluster and extract out the number of vCPU for the given cluster, each individual host and the advanced configuration Misc.RunningVCpuLimit set for each host.

In ESX 3.5 as Jason pointed out the default is 128 with maximum support of 192 and with vSphere ESX 4.0, this has changed to default of 512

Requirement:
VI Toolkit for Perl/vSphere SDK for Perl/VIMA 1.0/vMA 4.0
vCenter 2.5 / 4.0

Sample Execution:

On ESX 3.5:
[vi-admin@scofield]$ ./getNumofvCPUInCluster.pl --server reflex.primp-industries.com --username primp --cluster primp-cluster
This could take a few minutes depending on the size of the cluster ...

Cluster: primp-cluster
	Host: primp-esx01
		Misc.RunningVCpuLimit: 128
		# of vCPU on host: 12
	Host: primp-esx02
		Misc.RunningVCpuLimit: 128
		# of vCPU on host: 13
	Host: primp-esx03
		Misc.RunningVCpuLimit: 128
		# of vCPU on host: 16
	Host: primp-esx04
		Misc.RunningVCpuLimit: 128
		# of vCPU on host: 16
      ..........
      # of vCPU: 463

On ESX 4.0:

[vi-admin@scofield]$ ./getNumofvCPUInCluster.pl --server mauna-loa.primp-industries.com --username primp --cluster primpProd-cluster
This could take a few minutes depending on the size of the cluster ...

Cluster: primp-cluster
	Host: primp-esx01
		Misc.RunningVCpuLimit: 512
		# of vCPU on host: 21
	Host: primp-esx02
		Misc.RunningVCpuLimit: 512
		# of vCPU on host: 22
      # of vCPU: 23
Attachments:
Average User Rating
(2 ratings)




Comments

Aug 19, 2009 11:06 AM RS_1  says:

Hi, i got this error on any host in maintenance mode or with 0 VM on it : Use of uninitialized value in concatenation (.) or string at ./getNumofvCPUInCluster.pl line 51.
Hope it help

Aug 19, 2009 4:57 PM lamw  says: in response to: RS_1

I've just updated the code so it'll make sure the host is not in maintenance mode and also it's in a connected state. Basically it tried to print something that was not defined.


=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
http://twitter.com/lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Aug 19, 2009 5:17 PM RS_1  says: in response to: lamw

Thanks for all those great scripts William !

 

Developer Social Media

Communities