Last active
September 18, 2021 18:27
-
-
Save gowatana/4b30352f8378a6966f003d295357361c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-VMHost | Sort-Object Name | % { | |
$hv = $_ | |
$hv_pcpu_count = $hv.NumCpu | |
$power_on_vms = $hv | Get-VM | where {$_.PowerState -eq "PoweredOn"} | |
$hv_vcpu_count = ($power_on_vms| Measure-Object -Sum NumCpu).Sum + 0 | |
$hv_oc_percent = $hv_vcpu_count / $hv_pcpu_count * 100 | |
"-----" | |
$hv.Parent.Name + "/" + $hv.Name + " ConnectionState:" + $hv.ConnectionState | |
"$hv_pcpu_count pCPU で、$hv_vcpu_count vCPU が起動中です。" | |
"vCPU: " + ("■" * $hv_vcpu_count) + " => オーバーコミット: " + $hv_oc_percent + "%" | |
"pCPU: " + ("□" * $hv_pcpu_count) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
以前の下記投稿より。
PowerCLI で ESXiのCPUオーバコミット「見える化」
https://gowatana.github.io/vmtn-blogs-backup/communities.vmware.com/people/gowatana/blog/2013/08/06/powercli-%E3%81%A7-esxi%E3%81%AEcpu%E3%82%AA%E3%83%BC%E3%83%90%E3%82%B3%E3%83%9F%E3%83%83%E3%83%88-%E8%A6%8B%E3%81%88%E3%82%8B%E5%8C%96.html