1 2 Previous Next 25 Replies Latest reply on Feb 26, 2020 2:21 PM by LucD Go to original post
      • 15. Re: Average Network throughput for a VM with PowerCLI
        Madmax01 Hot Shot

        Hi Lucd,

         

        no Problem anyway . i'am glad that's working so fast.   output of 1200 Vm's     with average+maximum  was finished in  ~30min.  hat's 6 times faster.  holy .

         

        i have the Fealing that PowerCli is not prepared from DevTeam for a bigger Farm.  nearly every command runs slow.  ;(. they support a Mass vm's per Esx/vCenter > but code is not prepared using it like that. haha ;(.

        Also i won little time for installing the XMLSerializers.

         

        Luc  > you know maybe how to analyze the Code from the current cmdlets beeing able maybe changing it to a faster ones?  don't know where they are hidden.

         

        Best regards

         

        Max

        • 16. Re: Average Network throughput for a VM with PowerCLI
          LucD Guru
          vExpertUser ModeratorsCommunity Warriors

          The PowerCLI Dev Team has to write code that is a "fit for all", and that does a lot of additional computations.

          They are for example selecting/calculating a number of properties that are not provided directly by the API.

          That's afaik where a lot of the overhead goes into.

           

          By using the API directly (the Get-View cmdlet was a stroke of genius in that sence) one can optimise the code.

          But it requires knowledge of the API and some additional time investment in the coding of your scripts/functions.

          Note that the PowerCLI Dev Team also helped by providing the 'Get-View -ViewType ... -Property ... ' parameterset.

          And don't forget the way the ExtensionData property works.

          These are all timesavers.

           

          To analyse the code you can use the Onyx Project, but that will only show you (most of) the API that are used.

          It will not show you what other calculations are done on the data returned by the API calls.

           

          I did write some optimised code for often used functions (Get-Stat2, Get-VIEventPlus...), and there are some others available in the blogosphere.

          But in the end, to have optimised code, you will have to do some coding yourself I'm afraid, since you know best what works best in your environment.

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 17. Re: Average Network throughput for a VM with PowerCLI
            Madmax01 Hot Shot

            thx LucD > you're completely right. wish nice sunday

            • 18. Re: Average Network throughput for a VM with PowerCLI
              AlbertWT Master

              OK, after increasing the Statistics to level 3 today, would it be possible to run the same PowerShell script to get the stats for the past months or weeks ?

              • 19. Re: Average Network throughput for a VM with PowerCLI
                LucD Guru
                vExpertCommunity WarriorsUser Moderators

                I'm afraid not.

                The aggregation only starts collecting that data today.

                You'll have to wait a month

                Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                • 20. Re: Average Network throughput for a VM with PowerCLI
                  AlbertWT Master

                  I see,

                  Thanks for the sharing and the explanation Lucd.

                  • 21. Re: Average Network throughput for a VM with PowerCLI
                    AlbertWT Master

                    I got this error:

                     

                    Get-Stat The metric counter "net.throughput.usage.average" doesn't exist for entity "VM-TEST01".

                    +     [math]::Round((G <<<< et-Stat -Entity $_ -Start (Get-Date).AddDays(-1) -Stat "net.throughput.usage.average" |

                     

                    What was wrong with the script  below:

                    Get-VM | 
                    Select Name, @{N="Avg Network Throughput MBPs";E={
                        [math]::Round((Get-Stat -Entity $_ -Start (Get-Date).AddDays(-1) -Stat "net.throughput.usage.average" |
                        where {$_.Instance -eq ""} |
                        Measure-Object -Property Value -Average | Select -ExpandProperty Average)/1KB,2)
                    }}
                    

                     

                    I have already increased the statistics to level 3 in my VCenter last week.

                    • 22. Re: Average Network throughput for a VM with PowerCLI
                      LucD Guru
                      Community WarriorsUser ModeratorsvExpert

                      You also get that message when there is no data at the point in time specified with Start.

                      It could be that the VM was not powered on at (Get-Date).AddDays(-1).

                       

                      Do you statistical data for the VM at that point in time on the Performance tab in the Web Client?

                      Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                      • 23. Re: Average Network throughput for a VM with PowerCLI
                        JoeSze Lurker

                        Hi All,

                         

                        Because too many search pointing to this page and the real trick here is "net.usage.average". A HERO already said it and worth a bump.

                         

                        Thanks to OP as well.

                         

                        Cheer,

                        Joe

                        • 24. Re: Average Network throughput for a VM with PowerCLI
                          RJ4719 Novice

                          LucD, seen a script out there that will dig through a vcenter, and determine network throughput by vm and list cluster its in?

                          • 25. Re: Average Network throughput for a VM with PowerCLI
                            LucD Guru
                            User ModeratorsCommunity WarriorsvExpert

                            No, not verbatim, but it shouldn't be that hard to set up such a script.

                             

                            But may I suggest to start a new thread for that question.

                            There are already too many add-ons in this thread.

                             

                            Also mention if you want that data for 'now' or for a period in the past.


                            If for a period in the past, note that there some requirements for the Statistics Level.

                            Note that for VMs there is only the net.usage.average metric with Statistics Level 1.

                            There is also net.transmitted.average and net.received.average, but they require at least Statistics Level 2

                            Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                            1 2 Previous Next