Hello All,
I'm having the hardest time creating a script that will give me Cluster CPU and Memory Usage. I just need something simple if there is such a thing?
Example of what I'm looking for:
Cluster name | CPU GHz Capacity | CPU GHz Used | CPU % Free |
---|
Cluster name | Memory Capacity | Memory Used | Memory % Free |
---|
I need to present these in graphical format but I could look to do something with a pivot table afterwards.
Any help would be greatly appreciated.
Thanks
Something has gone a bit wrong. When running the original script I get
01/07/2016 01:00 | 86 | 41 | 52 | 576 | 412 | 28 |
02/07/2016 01:00 | 86 | 33 | 62 | 576 | 416 | 28 |
03/07/2016 01:00 | 86 | 32 | 63 | 576 | 416 | 28 |
04/07/2016 01:00 | 86 | 9 | 90 | 576 | 123 | 79 |
05/07/2016 01:00 | 86 | 33 | 62 | 576 | 363 | 37 |
06/07/2016 01:00 | 86 | 31 | 64 | 576 | 372 | 35 |
07/07/2016 01:00 | 86 | 31 | 64 | 576 | 374 | 35 |
08/07/2016 01:00 | 86 | 30 | 65 | 576 | 379 | 34 |
09/07/2016 01:00 | 86 | 31 | 64 | 576 | 383 | 34 |
10/07/2016 01:00 | 86 | 32 | 63 | 576 | 384 | 33 |
11/07/2016 01:00 | 86 | 29 | 66 | 576 | 385 | 33 |
12/07/2016 01:00 | 86 | 29 | 66 | 576 | 386 | 33 |
13/07/2016 01:00 | 86 | 31 | 64 | 576 | 384 | 33 |
14/07/2016 01:00 | 86 | 29 | 66 | 576 | 385 | 33 |
15/07/2016 01:00 | 86 | 31 | 64 | 576 | 386 | 33 |
16/07/2016 01:00 | 86 | 32 | 63 | 576 | 387 | 33 |
17/07/2016 01:00 | 86 | 31 | 64 | 576 | 389 | 32 |
18/07/2016 01:00 | 86 | 30 | 65 | 576 | 390 | 32 |
21/06/2016 01:00 | 86 | 32 | 63 | 576 | 414 | 28 |
22/06/2016 01:00 | 86 | 31 | 64 | 576 | 415 | 28 |
23/06/2016 01:00 | 86 | 29 | 66 | 576 | 415 | 28 |
24/06/2016 01:00 | 86 | 29 | 66 | 576 | 415 | 28 |
25/06/2016 01:00 | 86 | 30 | 65 | 576 | 416 | 28 |
26/06/2016 01:00 | 86 | 34 | 60 | 576 | 416 | 28 |
27/06/2016 01:00 | 86 | 33 | 62 | 576 | 416 | 28 |
28/06/2016 01:00 | 86 | 31 | 64 | 576 | 416 | 28 |
29/06/2016 01:00 | 86 | 32 | 63 | 576 | 416 | 28 |
30/06/2016 01:00 | 86 | 32 | 63 | 576 | 416 | 28 |
With the new script it returns
01/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
02/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
03/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
04/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
05/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
06/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
07/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
08/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
09/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
10/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
11/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
12/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
13/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
14/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
15/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
16/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
17/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
18/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
19/07/2016 01:00 | 86 | 0 | 100 | 576 | 131 | 77 |
22/06/2016 01:00 | 86 | 0 | 100 | 576 | 125 | 78 |
23/06/2016 01:00 | 86 | 0 | 100 | 576 | 125 | 78 |
24/06/2016 01:00 | 86 | 0 | 100 | 576 | 125 | 78 |
25/06/2016 01:00 | 86 | 0 | 100 | 576 | 125 | 78 |
26/06/2016 01:00 | 86 | 0 | 100 | 576 | 125 | 78 |
27/06/2016 01:00 | 86 | 0 | 100 | 576 | 125 | 78 |
28/06/2016 01:00 | 86 | 0 | 100 | 576 | 125 | 78 |
29/06/2016 01:00 | 86 | 0 | 100 | 576 | 125 | 78 |
30/06/2016 01:00 | 86 | 0 | 100 | 576 | 125 | 78 |
Seems I forgot to replace some $entity by $cluster.
I updated the script above
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Brilliant.
Thanks a lot for your help
Hello Luc,
I do see performance chart in webclient but no results when I run below coomand
Webclient > clutserts > select cluster name > performance > advanced > CPU I do see values available from Feb
PowerCLI C:\> Get-Cluster -Name Clustername | Get-Stat -start (get-date).AddDays(-40) -Finish (Get-Date).AddDays(-10) -MaxSamples 10000 -stat cpu.usage.average | Measure-Object -Property value -Average -Maximum -Minimum | select Average
PowerCLI C:\>
Hello LucD
I opened a support case with VMware on this . They pointing the problem with latest version of PCLI interacion with vSpehre6.
The same set of command works fine when I run against my other VC which is VCSA.
Hi, Thank you for your script. But I do not know why in last 30 Min result is wrong.
When I used -Realtime and -MaxSamples.
Time CPU GHz Capacity CPU GHz Used CPU % Free Mem Capacity GB Mem Used GB Mem % Free
---- ---------------- ------------ ---------- --------------- ----------- ----------
14/02/2020 10:10:00 441 211 52 5342 4038 24
14/02/2020 10:15:00 441 216 51 5342 4037 24
14/02/2020 10:20:00 441 218 51 5342 4037 24
14/02/2020 10:25:00 441 209 53 5342 4037 24
14/02/2020 10:30:00 441 208 53 5342 4037 24
14/02/2020 10:35:00 441 213 52 5342 4037 24
14/02/2020 10:40:00 441 206 53 5342 4037 24
14/02/2020 10:45:00 441 197 55 5342 4037 24
14/02/2020 10:50:00 441 210 52 5342 4037 24
14/02/2020 10:55:00 441 203 54 5342 4037 24
14/02/2020 11:00:00 441 210 52 5342 4037 24
14/02/2020 11:05:00 441 240 46 5342 4037 24
14/02/2020 11:10:00 441 226 49 5342 4037 24
14/02/2020 11:15:00 441 222 50 5342 4037 24
14/02/2020 11:20:00 441 238 46 5342 4037 24
14/02/2020 11:25:00 441 0 100 5342 3575 33
14/02/2020 11:30:00 441 0 100 5342 2881 46
14/02/2020 11:35:00 441 0 100 5342 2881 46
14/02/2020 11:40:00 441 0 100 5342 2297 57
14/02/2020 11:45:00 441 0 100 5342 1283 76
Thank you for your answer.
Cluster performance data is created by one of the rollup processes running on the vCenter.
This rollup job runs every 30 minutes.
So for cluster data, the Realtime data is not really 'realtime', and you should not take the last 30 minutes into account.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you so much for your answer.
This script works for some Cluster, but it does not work for some Cluster (in same datacenter).
Get-Stat : 18/02/2020 08:32:02 Get-Stat This operation is restricted by the administrator - 'vpxd.stats.maxQueryMetrics'. Contact your
system administrator.
At line:7 char:16
+ $clusterName | Get-Stat -Stat $stat -MaxSamples 20 |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-Stat], RestrictedByAdministrator
+ FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_GetStats_ErrorRetreivingPerfMetrics,VMware.VimAutomation.ViCore.Cmdlets.Com
mands.GetViStats
Thank you for your answer.
That is a known issue, see Re: This operation is restricted by the administrator Error when running get-stats command
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you so much for your answer.
How to change the date:
$start = (Get-Date).AddDays(-30)
By interval Date example:
$start = 2022-09-01
$finish= 2022-09-30
You can't with the Get-Stat cmdlet.
You will have to use a Where-clause after the Get-Stat, like I showed in PowerCLI & vSphere statistics – Part 2 – Come together
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference