VMware Cloud Community
khanbashi
Contributor
Contributor

No of vcpu per vm

Hi , can you someone help me to extract no of vcpu per vm

22 Replies
khanbashi
Contributor
Contributor

a report for all VM’s number of virtual sockets

0 Kudos
admin
Immortal
Immortal

This you can achieve from within the vSphere Web Client and the old vSphere Client.

Here is the way using the Web Client.

Click on Host and Clusters. Choose whether you need a list of VM on a vCenter Server, Datacenter or Cluster level.

If you need a list of all VMs choose the vCenter server and go to related objects. There you will find a tab for Virtual Machines, click it.

In the bottom, to the right, there is a export icon looking like this:

Screen Shot 2014-06-01 at 10.06.37.png

Click the icon. Then you can choose what information you want to export. By default the CPU count is not included, so you need to check the box. See the example below:

Screen Shot 2014-06-01 at 10.07.16.png

Hope this helps.

\Ibrar

0 Kudos
vThinkBeyondVM
VMware Employee
VMware Employee

Hi Friend,

You can go through this blog to understand cores/sockets/vcpus: These are great articles:

vCPU configuration. Performance impact between virtual sockets and virtual cores? - frankdenneman.nl

Sizing VMs and NUMA nodes - frankdenneman.nl

This post also will help you out:Re: List total number of vCPU per ESX host to avoid CPU over allocation when deploying VM

You can use ESXTOP : Please explore :http://www.yellow-bricks.com/esxtop/


----------------------------------------------------------------
Thanks & Regards
Vikas, VCP70, MCTS on AD, SCJP6.0, VCF, vSphere with Tanzu specialist.
https://vThinkBeyondVM.com/about
-----------------------------------------------------------------
Disclaimer: Any views or opinions expressed here are strictly my own. I am solely responsible for all content published here. Content published here is not read, reviewed or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware.

0 Kudos
khanbashi
Contributor
Contributor

Thanks but i need to have script to collect only the VSocket

Capture.JPG

0 Kudos
a_p_
Leadership
Leadership

Welcome to the Community,

Please take a look at e.g. Re: PowerCLI - Get number of cores per cpu and number of sockets to see whether this meets your requirements. Alternatively, you can get such information using RVTools

André

0 Kudos
khanbashi
Contributor
Contributor

i need to have script to collect only the VSocket


Capture.JPG

0 Kudos
khanbashi
Contributor
Contributor

Please i need your support .

0 Kudos
a_p_
Leadership
Leadership

The link I posted before contains a PowerCLI script. Did you see this?

André

0 Kudos
khanbashi
Contributor
Contributor

thanks but i need only to get the VSocket count not the total vCPU .

Capture.JPG

0 Kudos
a_p_
Leadership
Leadership

Is it this what you need?

$result = @()

    $vms = Get-view  -ViewType VirtualMachine

    foreach ($vm in $vms) {

        $obj = new-object psobject

        $obj | Add-Member -MemberType NoteProperty -Name name -Value $vm.Name

        $obj | Add-Member -MemberType NoteProperty -Name vSockets -Value ($vm.config.hardware.NumCPU / $vm.config.hardware.NumCoresPerSocket)

        $result += $obj

    }

    $result

André

khanbashi
Contributor
Contributor

not working ......

Capture1.JPG

0 Kudos
a_p_
Leadership
Leadership

That's most likely a copy&paste issue. Please use the attached file.

André

0 Kudos
khanbashi
Contributor
Contributor

thanks but i got the same result .

0 Kudos
khanbashi
Contributor
Contributor

Attempted to divide by zero.

At C:\Users\559702\Desktop\vCPUs.ps1:6 char:100

+         $obj | Add-Member -MemberType NoteProperty -Name vSockets -Value ($vm.config.hardware.NumCPU / <<<<  $vm.co

ig.hardware.NumCoresPerSocket)

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

    + FullyQualifiedErrorId : RuntimeException

Attempted to divide by zero.

At C:\Users\559702\Desktop\vCPUs.ps1:6 char:100

+         $obj | Add-Member -MemberType NoteProperty -Name vSockets -Value ($vm.config.hardware.NumCPU / <<<<  $vm.co

ig.hardware.NumCoresPerSocket)

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

    + FullyQualifiedErrorId : RuntimeException

Attempted to divide by zero.

At C:\Users\559702\Desktop\vCPUs.ps1:6 char:100

+         $obj | Add-Member -MemberType NoteProperty -Name vSockets -Value ($vm.config.hardware.NumCPU / <<<<  $vm.co

ig.hardware.NumCoresPerSocket)

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

    + FullyQualifiedErrorId : RuntimeException

Attempted to divide by zero.

At C:\Users\559702\Desktop\vCPUs.ps1:6 char:100

+         $obj | Add-Member -MemberType NoteProperty -Name vSockets -Value ($vm.config.hardware.NumCPU / <<<<  $vm.co

0 Kudos
khanbashi
Contributor
Contributor

when i rerun it with "NumCoresPerSocket" i got 0 value .  why ?

0 Kudos
Rubeck
Virtuoso
Virtuoso

You can also use RVTools for collecting this info.. http://www.robware.net/

Export the vCPU info to Excel and sort it.. 

/Rubeck

0 Kudos
khanbashi
Contributor
Contributor

no Vsocket in the RVTools

Capture.JPG

0 Kudos
Rubeck
Virtuoso
Virtuoso

no Vsocket in the RVTools

No?

vsocket.png

/Rubeck

0 Kudos
khanbashi
Contributor
Contributor

Thanks but which version you used for  RVTools

0 Kudos