VMware Cloud Community
Loagu
Contributor
Contributor

Script to capture Cluster level CPU and memory usage

HI Guys

Can someone help me in getting powershell script to capture the report on cluster wise cpu and memory usage for past 6 months   like the attached screen shot

CPU.jpgMem.jpg

0 Kudos
6 Replies
LucD
Leadership
Leadership

Those screenshots turn out to be rather smallish.
Can you attach a bigger version?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Loagu
Contributor
Contributor

Hi Lucd

Attached the screenshot again

CPU.jpg

Mem.jpg

0 Kudos
Loagu
Contributor
Contributor

Guys any help on this

0 Kudos
LucD
Leadership
Leadership

You do something like this.
Adapt the start date to your requirements.

Not sure which memory metrics are shown in that 2nd graph. Can you find out?
In any case, that would be the same code, just with different metrics.

$clusterName = 'MyCluster'

$stat = 'cpu.usagemhz.average','cpu.totalmhz.average'

$start = (Get-Date).AddDays(-14)

$cluster = Get-Cluster -Name $clusterName

Get-Stat -Entity $cluster -Stat $stat -Start $start


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Loagu
Contributor
Contributor

Hi Lucd

Am getting below error message

Get-Stat : 24/04/2017 18:12:28    Get-Stat        A specified parameter was not correct.

querySpec.size

At line:1 char:9

+ Get-Stat <<<<  -Entity $cluster -Stat $stat -Start $start

    + CategoryInfo          : NotSpecified: (:) [Get-Stat], InvalidArgument

    + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_GetStats_ErrorRetreivingPerfMetrics,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetViStats

0 Kudos
LucD
Leadership
Leadership

That's most probably the issue described in KB2107096


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos