4 Replies Latest reply on Apr 5, 2020 6:23 PM by mhervhin

    VM Performance Report

    mhervhin Novice

      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.

        • 1. Re: VM Performance Report
          LucD Guru
          vExpertUser ModeratorsCommunity Warriors
          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          1 person found this helpful
          • 2. Re: VM Performance Report
            mhervhin Novice

            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

            • 3. Re: VM Performance Report
              LucD Guru
              Community WarriorsUser ModeratorsvExpert

              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: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
              • 4. Re: VM Performance Report
                mhervhin Novice

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