0
The following Power-CLI command will evaluate a specific cluster and return the ratio of memory utilisation between Windows and Red Hat Linux virtual machines.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# Variable settings $clusterName = "insert cluster name" $winVMs = Get-Cluster $clusterName | Get-VM | ? {$_.Guest.OSFullName -like 'Microsoft Windows Server*'} | Select Name, PowerState, MemoryGB $lnxVMs = Get-Cluster $clusterName | Get-VM | ? {$_.Guest.OSFullName -like 'Red Hat*'} | Select Name, PowerState, MemoryGB foreach($winVM in $winVMs){ $winMemTotal += $winVM.MemoryGB } foreach($lnxVM in $lnxVMs){ $lnxMemTotal += $lnxVM.MemoryGB } $memTotal = $winMemTotal + $lnxMemTotal $winMemSplit = $winMemTotal / $memTotal $winMemSplit *= 100 $winMemSplit = [math]::Round($winMemSplit) $lnxMemSplit = $lnxMemTotal / $memTotal $lnxMemSplit *= 100 $lnxMemSplit = [math]::Round($lnxMemSplit) "Windows memory total is " + [math]::Round($winMemTotal) + "GB" "Linux memory total is " + [math]::Round($lnxMemTotal) + "GB" "The split between Windows and Linux is... Windows " + $winMemSplit + "% to Linux " + $lnxMemSplit + "%" |
0