Hoping to get some help with this as I just recently got into powercli scripting and what I am being asked to provide is a bit above my expertise right now.
I have an environment that has multiple virtual centers, multiple clusters in each virtual center, and multiple resource pools in each cluster. Resource Pools have specific names for example each cluster has a resource pools who's names start with 01 and resoure pools who's names start with 22. I need to be able to collect resource pool stats for only resource pools who's names start with 22 in all clusters that are in all virtual centers. I need to be able to collect cpu average, cpu maximum usage, memory average, memory maximum usage. These stats need to be collected in eight hour intervals so that it can be sent out three times a day (midnight, 8:00 am, 4:00 pm) and they need to be shown in a percentage. The resource pools correspond to an application compute pool so I also need to be able to convert the resource pool name to the compute pool name. So something like :
Compute pool 01 = virtual center 01, cluster 01, resource pool 22*
Compute pool 02 = virtual center 01, cluster 02, resource pool 22*
Compute pool 03 = virtual center 01, cluster 03, resource pool 22*
Compute pool 04 = virtual center 02, cluster 01, resource pool 22*
I have also attached an empty spreadsheet that shows an example of the fields I need.
I appreciate any help I could get or if someone could point me in the right direction.
You can use a CSS style sheet on the ConvertTo-Html cmdlet.
But then we are entering the HTML and CSS world, which is not really something I know a lot about.
In any case, try like this (you can change the style sheet to whatever your like).
$excelStyle = @'
<style>
*
{
font-family:Calibri,sans-serif;
font-size:11pt;
}
p
{
margin:0 0 8pt;
}
td p
{
margin:0 0 0;
}
h1,h2,h3
{
font-family:"Calibri Light",sans-serif;
font-weight:400;
line-height:107%;
margin:2pt 0 0;
page-break-after:avoid;
}
h1
{
color:#2E74B5;
font-family:"Calibri Light",sans-serif;
font-size:16pt;
margin-top:12pt;
}
h2
{
color:#2E74B5;
font-size:13pt;
}
h3
{
color:#1F4D78;
font-family:"Calibri Light",sans-serif;
font-size:12pt;
}
table
{
border:solid #9BC2E6 1pt;
border-collapse:collapse;
width:100%;
}
th
{
background-color:#5B9BD5;
border:solid #9BC2E6 1pt;
color:#FFF;
font-weight:700;
height:14.5pt;
padding:0 5.4pt;
text-align:left;
vertical-align:bottom;
}
td
{
padding:0;
border-bottom: 1px solid #9BC2E6;
}
td p
{
margin:0 0 0;
}
tr:nth-child(even)
{
background-color:#DDEBF7;
}
tr:hover
{
background-color:#eee;
}
</style>
'@
$data = @'
App Pool Name,Resource Pool Name,Virtual Media Center,Virtual Cluster
01,22_aaa_100,VMC001,VCL100
02,22_aaa_103,VMC002,VCL110
04,22_aaa_1,VMC002,VCL120
05,22_aaa_2,VMC002,VCL130
06,22_aaa_3,VMC002,VCL140
07,22_aaa_1,VMC003,VCL150
08,22_aaa_2,VMC003,VCL160
09,22_aaa_3,VMC003,VCL170
10,22_aaa_4,VMC002,VCL180
11,22_aaa_5,VMC001,VCL100
12,22_aaa_4,VMC003,VCL190
13,22_aaa_1,VMC004,VCL200
14,22_aaa_2,VMC004,VCL210
15,22_aaa_3,VMC004,VCL220
17,22_aaa_1,VMC005,VCL230
18,22_aaa_1,VMC006,VCL220
19,22_aaa_2,VMC006,VCL230
20,22_aaa_3,VMC006,VCL240
21,22_aaa_4,VMC006,VCL250
23,22_aaa_3,VMC005,VCL260
24,22_aaa_4,VMC005,VCL270
25,22_aaa_1,VMC007,VCL280
26,22_aaa_2,VMC007,VCL290
'@
$appTab = @{}
ConvertFrom-Csv -InputObject $data |
ForEach-Object -Process {
$key = "$($_.'Virtual Media Center')-$($_.'Virtual Cluster')-$($_.'Resource Pool Name')"
$appTab.Add($key,$_.'App Pool Name')
}
$rp = Get-ResourcePool | where{$_.Name -match "^22"}
$reportName = ".\report-$(Get-Date -Format yyyyMMdd-HHmm).csv"
$sStat = @{
Entity = $rp
Start = (Get-Date).AddHours(-8)
Stat = 'mem.consumed.average','cpu.usagemhz.average'
}
Get-Stat @sStat |
Group-Object -Property {$_.EntityId} |
ForEach-Object -Process {
$rp = $_.Group[0].Entity
$vc = ([uri]$rp.ExtensionData.Client.ServiceUrl).Host.Split('.')[0]
$cluster = (Get-View -Id $rp.ExtensionData.Owner).Name
$cpuStat = $_.Group | where{$_.MetricId -eq 'cpu.usagemhz.average'} |
Measure-Object -Property Value -Maximum -Average
$memStat = $_.Group | where{$_.MetricId -eq 'mem.consumed.average'} |
Measure-Object -Property Value -Maximum -Average
$obj = [ordered]@{
vCenter = $vc -replace '(\D+)(\d+)','$2'
'Virtual Cluster' = $cluster -replace '(\D+)(\d+)','$2'
'Resource Pool name (Virtual Center)' = $rp.Name
'Compute Pool Name (Application)' = $appTab.Item("$($vc)-$($cluster)-$($rp.Name)")
'Average CPU Usage Percent' = [math]::Round(($cpuStat.Average/$rp.CpuReservationMHz*100),1)
'Peak CPU Usage Percent' = [math]::Round(($cpuStat.Maximum/$rp.CpuReservationMHz*100),1)
'Average Memory Usage Percent' = [math]::Round(($memStat.Average/1KB)/($rp.MemReservationMB*100),1)
'Peak Memory Usage Percent' = [math]::Round(($memStat.Maximum/1KB)/($rp.MemReservationMB*100),1)
}
New-Object PSObject -Property $obj
} |
Export-Csv -Path $reportName -NoTypeInformation -UseCulture
$sMail = @{
Subject = 'Report'
From = 'you@domain.com'
To = 'you@domain.com'
SmtpServer = 'mail.domain.com'
BodyAsHtml = $true
Body = Import-csv -Path $reportName | ConvertTo-Html -Head $excelStyle | Out-String
}
Send-MailMessage @sMail
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Depending on the Statistic Levels you have specified in your vCenter, the peak (Maximum) values can be available directly from the performance metrics, or need to be calculated from the average values.
Can you check which metric are available in your environment with
$rp = Get-ResourcePool | where{$_.Name -match "^22"}
$sStat = @{
Entity = $rp
Start = (Get-Date).AddHours(-8)
}
Get-StatType @sStat
As an alternative we could start from the metrics available for VMs, and calculate the resourcepool values from there.
But again, I would need to know what kind of metrics are available.
Can you check with
$vm = Get-ResourcePool | where{$_.Name -match "^22"} | Get-VM
$sStat = @{
Entity = $vm
Start = (Get-Date).AddHours(-8)
}
Get-StatType @sStat
Before running these snippets, make sure you are connected to all vCenters (check by displaying $global:defaultviservers), and that you run PowerCLI in Multiple mode.
Check with Get-PowerCLIConfiguraton
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Running the first script gives me the output of
cpu.usagemhz.average
cpu.cpuentitlement.latest
mem.mementitlement.latest
mem.overhead.average
mem.consumed.average
mem.granted.average
mem.active.average
mem.shared.average
mem.zero.average
mem.swapped.average
mem.vmmemctl.average
mem.compressed.average
mem.compressionRate.average
mem.decompressionRate.average
power.power.average
Running the second script gives me an output of
cpu.usage.average
cpu.usagemhz.average
cpu.ready.summation
cpu.idle.summation
mem.usage.average
mem.granted.average
mem.active.average
mem.shared.average
mem.zero.average
mem.swapped.average
mem.swaptarget.average
mem.swapinRate.average
mem.swapoutRate.average
mem.vmmemctl.average
mem.vmmemctltarget.average
mem.consumed.average
mem.overhead.average
mem.compressed.average
mem.compressionRate.average
mem.decompressionRate.average
disk.maxTotalLatency.latest
net.usage.average
net.packetsRx.summation
net.packetsTx.summation
net.received.average
net.transmitted.average
sys.uptime.latest
virtualDisk.read.average
virtualDisk.write.average
datastore.read.average
datastore.write.average
cpu.cpuentitlement.latest
mem.mementitlement.latest
disk.used.latest
disk.provisioned.latest
disk.unshared.latest
power.power.average
net.droppedRx.summation
net.droppedTx.summation
mem.swapin.average
mem.swapout.average
mem.activewrite.average
mem.overheadMax.average
mem.zipped.latest
mem.zipSaved.latest
virtualDisk.readOIO.latest
virtualDisk.writeOIO.latest
virtualDisk.readLoadMetric.latest
virtualDisk.writeLoadMetric.latest
cpu.latency.average
cpu.entitlement.latest
cpu.demand.average
cpu.costop.summation
cpu.maxlimited.summation
cpu.run.summation
mem.latency.average
mem.entitlement.average
mem.llSwapInRate.average
mem.llSwapOutRate.average
net.bytesRx.average
net.bytesTx.average
net.broadcastRx.summation
net.broadcastTx.summation
net.multicastRx.summation
net.multicastTx.summation
I found an old sample report and for the memory average percent and maximum percent over an 8 hour period it is taking the numbers you get if you click the resource pool >>> performance>>>chart options>>>custom>>>last 8 hours>>>. Doing that shows me max min avg memory in the performance chart graph. Those numbers are in kilobytes and the resource pool memory reservation is in megabytes, but if I just divide those numbers and keep the manual math consistent, converting both to gigabytes to get smaller numbers, I get the percentage of memory average and maximum memory usage and it matches what is in the old sample report. So the memory numbers needed are just the max and avg of that chart / resource pool memory reservation number
The 1st output clearly shows that the metrics for mem.usage and cpu.usage are not available for resourcepools.
We could calculate the ratio of the cpu.usagemkhz.average over the total Mhz available, to get a percentage.
But the mem.usage is not collected for a resourcepool.
Here we can use the mem.usage of the all the VMs in that resourcepool, and use the sum as a number for the resourcepool.
You are also not collecting the min and max values of the available metrics, only the average.
That is due to the Statistics Level you have defined on your vCenter.
To get min and max you would need level 4, but that requires a lot of disk space for the vCenter DB.
You can determine the max and min from the average values that are seen over the interval.
And that is most probably what your report is showing.
But be aware that is not the real min and max, only the min and max of the averages.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD. For now I want to keep this report consistent since the system owners asked for the report to look the same as the example they gave me. I am aware it is only the max and min of the averages and that is fine with me and the system owners as well. I see that one of the counters in the first script is mem.consumed.average. I am assuming that is the counter for the consumed memory measurement on the performance graph? If so then I would need a script to divide the maximum and averages numbers by the resource pool memory reservation number. For cpu I am assuming the cpu.usagemhz.average is the counter for the usage in mhz measurement on the performance chart? If so then I would need the script to divide the numbers in the maximum and average tab by the resource pool cpu reservation number as well.
The script skeleton could look like this
$rp = Get-ResourcePool | where{$_.Name -match "^22"}
$sStat = @{
Entity = $rp
Start = (Get-Date).AddHours(-8)
Stat = 'mem.consumed.average','cpu.usagemhz.average'
}
Get-Stat @sStat |
Group-Object -Property {$_.Entity.Name} |
ForEach-Object -Process {
$rp = $_.Group[0].Entity
$obj = [ordered]@{
vCenter = ([uri]$rp.ExtensionData.Client.ServiceUrl).Host
Cluster = (Get-View -Id $rp.ExtensionData.Owner).Name
ResourcePool = $rp.Name
ComputePool = ''
CpuAvg = 0
CpuPeak = 0
MemAvg = 0
MemPeak = 0
}
New-Object PSObject -Property $obj
}
But I have a couple of questions, before I could add the values in there
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If I click edit on the resource pool, for reservation and limit, that number is the same for both memory and cpu. So for example in cluster 01 resource pool 22, the resource pool reservation and limit for cpu are both set to 400000mhz and the memory reservation and limit are both set to 1192050MB. The numbers are different for each resource pool but in all cases the reservation and the limit are both set to the same number and this is the number that the avg and max of the avg is divided by to generate the report. So the reservation and limit are the same for both memory and cpu.
I have attached a spreadsheet that maps application pool to resource pool to virtual media center to virtual cluster
Try like this
$data = @'
App Pool Name,Resource Pool Name,Virtual Media Center,Virtual Cluster
App Pool 01,22_aaa_100,VMC001,VCL100
App Pool 02,22_aaa_103,VMC002,VCL110
App Pool 04,22_aaa_1,VMC002,VCL120
App Pool 05,22_aaa_2,VMC002,VCL130
App Pool 06,22_aaa_3,VMC002,VCL140
App Pool 07,22_aaa_1,VMC003,VCL150
App Pool 08,22_aaa_2,VMC003,VCL160
App Pool 09,22_aaa_3,VMC003,VCL170
App Pool 10,22_aaa_4,VMC002,VCL180
App Pool 11,22_aaa_5,VMC001,VCL100
App Pool 12,22_aaa_4,VMC003,VCL190
App Pool 13,22_aaa_1,VMC004,VCL200
App Pool 14,22_aaa_2,VMC004,VCL210
App Pool 15,22_aaa_3,VMC004,VCL220
App Pool 17,22_aaa_1,VMC005,VCL230
App Pool 18,22_aaa_1,VMC006,VCL220
App Pool 19,22_aaa_2,VMC006,VCL230
App Pool 20,22_aaa_3,VMC006,VCL240
App Pool 21,22_aaa_4,VMC006,VCL250
App Pool 23,22_aaa_3,VMC005,VCL260
App Pool 24,22_aaa_4,VMC005,VCL270
App Pool 25,22_aaa_1,VMC007,VCL280
App Pool 26,22_aaa_2,VMC007,VCL290
'@
$appTab = @{}
ConvertFrom-Csv -InputObject $data |
ForEach-Object -Process {
$key = "$($_.'Virtual Media Center')-$($_.'Virtual Cluster')-$($_.'Resource Pool Name')"
$appTab.Add($key,$_.'App Pool Name')
}
$rp = Get-ResourcePool | where{$_.Name -match "^22"}
$sStat = @{
Entity = $rp
Start = (Get-Date).AddHours(-8)
Stat = 'mem.consumed.average','cpu.usagemhz.average'
}
Get-Stat @sStat |
Group-Object -Property {$_.Entity.Name} |
ForEach-Object -Process {
$rp = $_.Group[0].Entity
$vc = ([uri]$rp.ExtensionData.Client.ServiceUrl).Host
$cluster = (Get-View -Id $rp.ExtensionData.Owner).Name
$cpuStat = $_.Group | where{$_.MetricId -eq 'cpu.usagemhz.average'} |
Measure-Object -Property Value -Maximum -Average
$memStat = $_.Group | where{$_.MetricId -eq 'mem.consumed.average'} |
Measure-Object -Property Value -Maximum -Average
$obj = [ordered]@{
vCenter = $vc
'Virtual Cluster' = $cluster
'Resource Pool name (Virtual Center)' = $rp.Name
'Compute Pool Name (Application)' = $appTab.Item("$vc-$cluster-$($rp.Name)")
'Average CPU Usage Percent' = [math]::Round(($cpuStat.Average/$rp.CpuReservationMHz)*100,1)
'Peak CPU Usage Percent' = [math]::Round(($cpuStat.Maximum/$rp.CpuReservationMHz)*100,1)
'Average Memory Usage Percent' = [math]::Round(($memStat.Average/1KB)/($rp.MemReservationMB*100),1)
'Peak Memory Usage Percent' = [math]::Round(($memStat.Maximum/1KB)/($rp.MemReservationMB*100),1)
}
New-Object PSObject -Property $obj
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Runs but with some issues.
1. I was getting “get-stat this operation is restricted by the administrator” for 4 of the 7 virtual centers but after adding “config.vpxd.stats.MaxQueryMetrics -1” to all of the virtual centers I no longer get this error.
2. The script only returns 7 of the 23 resource pools. Looking at the output it only returns one of the resource pools that have a similar name. so for example there are 6 "22_aaa_1" spread across multiple virtual centers and virtual clusters but the script only returns a value for 1 of the 6. It is like that for all resource pools with same name but in different virtual center and cluster. There are 3 resource pools that do not have a recurring name and all 3 show in the output.
There is no value in the “compute pool (Application) field in the output. It is blank.
Both Memory Usage Percent and Peak Memory Usage Percent show 0 in the output. The values for both average cpu usage percent and peak cpu usage percent are correct.
Ok, let's take this step by step.
First can you replace this line
Group-Object -Property {$_.Entity} |
by this line
Group-Object -Property {$_.EntityId} |
and check if you now get all the resourcepools?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I changed Group-Object -Property {$_.Entity.Name} | to Group-Object -Property {$_.EntityId.Name} |. I ran the script and get WARNING: The 'EntityId' property of Sample type is deprecated. Use the 'Entity' property instead. It only shows one resource pool in the output where before it showed seven.
That is a warning, nothing serious.
And you see that warning, because you have not configured your PowerCLI settings to not show deprecated warnings.
That you only see one resourcepool now is very strange.
What does this show?
Get-ResourcePool | where{$_.Name -match "^22"} |
Select Name,Id
And this?
$rp = Get-ResourcePool | where{$_.Name -match "^22"}
$sStat = @{
Entity = $rp
Start = (Get-Date).AddHours(-2)
Stat = 'mem.consumed.average','cpu.usagemhz.average'
}
Get-Stat @sStat | Select Entity,EntityId | Sort-Object -Unique
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hold on, just noticed that you used $_.EntityId.Name, that should be
Group-Object -Property {$_.EntityId}
That also explains why you end up with only 1 resourcepool
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ok I believe I just misinterpreted what you ask for in the original change.
Originaly, the line in the script is :
Group-Object -Property {$_.Entity.Name} |
Then when you asked:
First can you replace this line
Group-Object -Property {$_.Entity} |
by this line
Group-Object -Property {$_.EntityId} |
and check if you now get all the resourcepools?
I thought you meant just change it from Entity.Name to EntityId.Name since the .Name is in the original post of the script.
I think I am back on track now. I replaced Group-Object -Property {$_.Entity.Name} |
With Group-Object -Property {$_.EntityId}
Now I get all 23 resource pools across all clusters and virtual centers. However they still do not have anything in the compute pool name section and they still show all 0’s for average memory usage percent and peak memory usage percent
Ok, no problem.
Now let's see if there is anything wrong with the keys the script uses to get Application pool.
I added a couple of debug lines in this version.
Can you check what comes out?
$data = @'
App Pool Name,Resource Pool Name,Virtual Media Center,Virtual Cluster
App Pool 01,22_aaa_100,VMC001,VCL100
App Pool 02,22_aaa_103,VMC002,VCL110
App Pool 04,22_aaa_1,VMC002,VCL120
App Pool 05,22_aaa_2,VMC002,VCL130
App Pool 06,22_aaa_3,VMC002,VCL140
App Pool 07,22_aaa_1,VMC003,VCL150
App Pool 08,22_aaa_2,VMC003,VCL160
App Pool 09,22_aaa_3,VMC003,VCL170
App Pool 10,22_aaa_4,VMC002,VCL180
App Pool 11,22_aaa_5,VMC001,VCL100
App Pool 12,22_aaa_4,VMC003,VCL190
App Pool 13,22_aaa_1,VMC004,VCL200
App Pool 14,22_aaa_2,VMC004,VCL210
App Pool 15,22_aaa_3,VMC004,VCL220
App Pool 17,22_aaa_1,VMC005,VCL230
App Pool 18,22_aaa_1,VMC006,VCL220
App Pool 19,22_aaa_2,VMC006,VCL230
App Pool 20,22_aaa_3,VMC006,VCL240
App Pool 21,22_aaa_4,VMC006,VCL250
App Pool 23,22_aaa_3,VMC005,VCL260
App Pool 24,22_aaa_4,VMC005,VCL270
App Pool 25,22_aaa_1,VMC007,VCL280
App Pool 26,22_aaa_2,VMC007,VCL290
'@
$appTab = @{}
ConvertFrom-Csv -InputObject $data |
ForEach-Object -Process {
$key = "$($_.'Virtual Media Center')-$($_.'Virtual Cluster')-$($_.'Resource Pool Name')"
$appTab.Add($key,$_.'App Pool Name')
Write-Host "Tab Key: $key"
}
$rp = Get-ResourcePool | where{$_.Name -match "^22"}
$sStat = @{
Entity = $rp
Start = (Get-Date).AddHours(-8)
Stat = 'mem.consumed.average','cpu.usagemhz.average'
}
Get-Stat @sStat |
Group-Object -Property {$_.EntityId} |
ForEach-Object -Process {
$rp = $_.Group[0].Entity
$vc = ([uri]$rp.ExtensionData.Client.ServiceUrl).Host
$cluster = (Get-View -Id $rp.ExtensionData.Owner).Name
$cpuStat = $_.Group | where{$_.MetricId -eq 'cpu.usagemhz.average'} |
Measure-Object -Property Value -Maximum -Average
$memStat = $_.Group | where{$_.MetricId -eq 'mem.consumed.average'} |
Measure-Object -Property Value -Maximum -Average
Write-Host "Group Key: $($vc-$cluster-$($rp.Name))"
$obj = [ordered]@{
vCenter = $vc
'Virtual Cluster' = $cluster
'Resource Pool name (Virtual Center)' = $rp.Name
'Compute Pool Name (Application)' = $appTab.Item("$vc-$cluster-$($rp.Name)")
'Average CPU Usage Percent' = [math]::Round(($cpuStat.Average/$rp.CpuReservationMHz)*100,1)
'Peak CPU Usage Percent' = [math]::Round(($cpuStat.Maximum/$rp.CpuReservationMHz)*100,1)
'Average Memory Usage Percent' = [math]::Round(($memStat.Average/1KB)/($rp.MemReservationMB*100),1)
'Peak Memory Usage Percent' = [math]::Round(($memStat.Maximum/1KB)/($rp.MemReservationMB*100),1)
}
New-Object PSObject -Property $obj
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I now get a TAB KEY line for each resource pool. It list the virtual media center, the virtual cluster, and the resource pool name.
I get an error that shows:
“Cannot convert value "of virtual media center name" to type "System.Int32". Error: "Input string was not in a correct format."
At line:11 char:30
+ Write-Host "Group Key: $($vc-$cluster-$($rp.Name))"
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastFromStringToInteger
Then it gives me the exact same output as before for all 23 resource pools. However looking at the script I noticed some differences in the math for the cpu and the memory
'Average CPU Usage Percent' = [math]::Round(($cpuStat.Average/$rp.CpuReservationMHz)*100,1)
'Peak CPU Usage Percent' = [math]::Round(($cpuStat.Maximum/$rp.CpuReservationMHz)*100,1)
'Average Memory Usage Percent' = [math]::Round(($memStat.Average/1KB)/($rp.MemReservationMB*100),1)
'Peak Memory Usage Percent' = [math]::Round(($memStat.Maximum/1KB)/($rp.MemReservationMB*100),1)
For the memory the *100 is inside the first parentheses and for the cpu it is outside the first parentheses. I changed the memory usage to outside the first parentheses to match the cpu and now I get numbers for average memory usage percent and peak memory usage percent. Luckily for me these clusters get around the same amount of usage all day every day so checking these numbers against old reports I can confirm that they are similar to what it shows for memory on an 8 hour basis. Can you confirm that the memory calculation is supposed to be the same as the cpu calculation where the *100 happenes outside of the first parentheses?
If so then the only thing that is not working is their not being any data in the compute pool name field.
Yes, that was obviously a typo, the *100 should be outside the parenthesis for both memory values.
The "Tab Key" line contains the key I use in the hash table.
But you should also see "Group Key" line before each resourcepool.
I wanted to verify that the keys are constructed correctly on both locations.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It does say group key before every resource pool:
Group Key:
vCenter : VMC001
Virtual Cluster : VCL100
Resource Pool name (Virtual Center) : 22_aaa_100
Compute Pool Name (Application) : no data
Average CPU Usage Percent : 7.8
Peak CPU Usage Percent : 11.3
Average Memory Usage Percent : 55.2
Peak Memory Usage Percent : 56.7
Can you replace this line
Write-Host "Group Key: $($vc-$cluster-$($rp.Name))"
with this one?
Write-Host "Group Key: $($vc)-$($cluster)-$($rp.Name)"
And also this line
'Compute Pool Name (Application)' = $appTab.Item("$vc-$cluster-$($rp.Name)")
with this line
'Compute Pool Name (Application)' = $appTab.Item("$($vc)-$($cluster)-$($rp.Name)")
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Group Key field is now populated with virtual media center name, virtual cluster name, resource pool name
Group Key: VMC001-VCL100-22_aaa_100
vCenter : VMC001
Virtual Cluster : VCL100
Resource Pool name (Virtual Center) : 22_aaa_100
Compute Pool Name (Application) : no data
Average CPU Usage Percent : 7.8
Peak CPU Usage Percent : 11.3
Average Memory Usage Percent : 55.2
Peak Memory Usage Percent : 56.7
I do have another question? How would I export this to an excel sheet? Ideally I would like the script to generate an excel sheet that I can send out to the teams requesting the information