Hi All.
I found some hints to get CPU MHz Infos. All of them (until now) based on the VM host values. They are wrong from guest point of view. The host values are more less statistic values, if I follow those example:
Get-VM "<guest name>" | Select-Object -Property Name,@{Name='MaxHostCpuMhz';Expression={$_.NumCpu * $_.VMHost.CpuTotalMhz / $_.VMHost.NumCpu}}
ProcessorType: Intel(R) Xeon(R) Gold 6146 CPU @ 3.20GHz
If I have a look on the guest side with dmiodecode --type processor, I have complete different values:
Manufacturer: GenuineIntel
Version: Intel(R) Xeon(R) CPU E7- 4807 @ 1.87GHz
How can I get the real / current guest values with the Power CLI and there options?
Thanks for a short example, I guess with Invoke-Script... A link to more detailed tutorial using Invoke-Script on guest systems would perhaps help also.
Volker
I don't understand why you would be getting 0 if the individual values are what you show here.
There are 2 types of objects in PowerCLI.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Not sure if im understanding exactly what youre wanting but if youre looking for current utilization values then you could use get-stat e.g.
Get-stat -entity $_ -Stat cpu.usage.average -Realtime -MaxSamples 1
Do you get different values when you run this?
Select-Object -Property Name,
@{N='vCPUMhz';E={$_.ExtensionData.Runtime.MaxCpuUsage/$_.NumCpu}},
@{Name='HostCpuMhz';Expression={$_.VMHost.CpuTotalMhz / $_.VMHost.NumCpu}}
I get (on an Ubuntu box with 2 vCPU)
And this corresponds with what dmidecode tells me.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD
I get vCPUMhz = 0 and HostCpuMhz is empty (or null)
What is this returning?
Select-Object -Property Name,NumCpu,CoresPerSocket,
@{N='MaxCPUMhz';E={$_.ExtensionData.Runtime.MaxCpuUsage}},
@{N='VMHostNumCpu';E={$_.VMHost.NumCpu}},
@{N='HostCpuMhz';E={$_.VMHost.CpuTotalMhz}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi T180985.
I want no monitoring values about a VM. I want only get the CPU values (MHz / Type) from VM point of view. To calculate values based on the host data is perhaps not the real view.
Name | : my vm name |
NumCpu | : 2 |
CoresPerSocket : 1
MaxCPUMhz | : 6384 |
VMHostNumCpu : 16
HostCpuMhz | : 51072 |
Hi LucD.
Exist somewhere a link to a full description abount the data model useable by PowerCLI? I think, (no, I know ) if I a have look at this, I know than what is possible and what not?
I don't understand why you would be getting 0 if the individual values are what you show here.
There are 2 types of objects in PowerCLI.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I "solved" for now with the values from:
$cpuType | = $vm.VMHost.ProcessorType | |
$cpuMaxMhz | = [String] ([convert]::ToInt32($vm.ExtensionData.Runtime.MaxCpuUsage) / [convert]::ToInt32($vm.NumCpu)) |
inside my script.
It's ok for now, but in fact I would prefer the values from a dmidecode. I guess, I need to do it anyway with Invoke-Script, because I also need the guests BIOS values...
Yes, that would be the way to go.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference