VMware Cloud Community
mhervhin
Contributor
Contributor

VM Performance Report

I am new with PowerCLI and would like to achive below requirements for our VM performance report on a 10-minutes interval

- latest VM CPU and Memory Usage (in percentage)

- virtual disk or storage IOPs

- virtual disk or storage latency

- Disk space usage (in percentage)

- Report should be generated on a 10-minutes interval (would like to know how can I set this to be automatically generated every 10-minutes)

- Report should be uploaded automatically via WinSCP to a remote file server (a Linux file server)

Any assistance will be gladly appreciated.

Thank you in advance.

4 Replies
LucD
Leadership
Leadership

mhervhin
Contributor
Contributor

Apologies, and thanks for these info, LucD. I am not aware that we have some guidelines when posting to this group.

Below is the script that I am using to collect the CPU and Memory usage (credits to the owner on this forum). As mentioned I am not a scripting guys, therefore I am trying my best to achieve my requirements based on the others script on this forum.

I've been trying to look for a reference regarding how to upload and automatically dump the output of the script to a Linux machine via WinSCP but to no luck. Hope someone can enlighten me regarding this.

Thanks again in advance.

$vms = Get-Content D:\Test\Test.txt
$start = (Get-Date).AddMinutes(-1)
Get-Stat -Entity $vms -Start $start -ErrorAction SilentlyContinue |
Group-Object -Property {$_.Entity.Name} |
Select @{N='VM';E={$_.Name}},
@{N='CPU(%)';E={"{0:N1}" -f ($_.Group | where{$_.MetricID -eq 'cpu.usage.average'} | Measure-Object -Property Value -Average | select -ExpandProperty Average)}},
@{N='Memory(%)';E={"{0:N1}" -f ($_.Group | where{$_.MetricID -eq 'mem.usage.average'} | Measure-Object -Property Value -Average | select -ExpandProperty Average)}} |
Export-CSV D:\Test\Test.csv -NoTypeInformation -UseCulture

Reply
0 Kudos
LucD
Leadership
Leadership

Have a look at Using WinSCP .NET Assembly from PowerShell

It shows how to do a WinSCP file upload and also refers to a module to use the .NET WinSCP assembly


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

Reply
0 Kudos
mhervhin
Contributor
Contributor

Thanks, LucD. I will look onto those articles and inputs. Much appreciated.

Reply
0 Kudos