1 2 Previous Next 15 Replies Latest reply on Jun 3, 2019 1:38 AM by LucD

    Performance Reporting

    LinaT Novice

      Hello,

      Please i need your support as i'm trying to genertae a performance report for alot of servers on a monthly basis, i need something to generate this report as a bulk report.

      we're using powershell 5

      Thank you

        • 1. Re: Performance Reporting
          LucD Guru
          Community WarriorsUser ModeratorsvExpert

          And would you like fries or rice with that order?

           

          Seriously, this is not a free "write a script for me" community, but a place where community members try to provide answers to questions or specific issues other users might encounter.

           

          At least you could provide some more details on what you are trying to achieve.
          And even better, come with a concrete question, showing what you already have and where you got stuck.
          Did you even do a search in this community before posting this?

          • 2. Re: Performance Reporting
            LinaT Novice

            Hello,

            There's no need for making fun, i searched and i found somethings and people answer and help so that''s why i was encouraged to ask here.

            Answering your question, yes i did try the attached script and the output was an empty csv file that's why i'm trying to find support.

            1 person found this helpful
            • 3. Re: Performance Reporting
              LucD Guru
              vExpertUser ModeratorsCommunity Warriors

              I was definitely not trying to make fun of you, just of the type of question.
              We sometimes get some very 'general' questions in here, not specifying any details, which are in fact nothing more than a "do my work for me" kind of request.

               

              Now with your last reply, you asked a practical question.
              That is something we can try to help you with.


              Some things to check/answer:

               

              • how did you run the script? From a PS prompt? From a .ps1 file?
              • are you connected to a vCenter before running the script? Or an ESXi node?
              • the attached file contains some funny characters, but that might be due to a regional setting on your station. In any case, I start from the edited version below.
              • do you keep statistical data for at least 30 days in your vCenter? On an ESXi node you don't have historical statistical data.
              • in the Web Client, under the Performance tab, do you see data for the VMs when you select a 30 day period?

               

               

              $metrics = "cpu.usage.average", "mem.usage.average", "disk.usage.average"

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


              $folders = Get-Folder -Location (Get-Folder -Name vm -Location Datacenters)

              # $folders = Get-Folder -Name Folder1,Folder2,Folder3

              & { foreach ($folder in $folders)

                 {

                 $vms = Get-VM -Location $folder

                 if ($vms)

                 {

                 $stats = Get-Stat -Entity $vms -Stat $metrics -Start $start -ErrorAction SilentlyContinue

                 if ($stats)

                 {

                 $stats | Group-Object -Property { $_.Entity.Name } | % {

                 New-Object PSObject -Property @{

                 Folder = $folder.Name

                 VM = $_.Values[0]

                 CpuAvg = ($_.Group | where { $_.MetricId -eq "cpu.usage.average" } | Measure-Object -Property Value -Average).Average

                 MemAvg = ($_.Group | where { $_.MetricId -eq "mem.usage.average" } | Measure-Object -Property Value -Average).Average

                 DiskAvg = ($_.Group | where { $_.MetricId -eq "disk.usage.average" } | Measure-Object -Property Value -Average).Average

                 }

                 }

                 }

                 }

                 } } | Export-Csv C:\report.csv -NoTypeInformation -UseCulture

              1 person found this helpful
              • 4. Re: Performance Reporting
                LinaT Novice

                Hello,

                Sorry for the delay,

                we run the script and confirm that we connect to Vcenter before running it.

                In the v-center we have 30 days to get data

                 

                we ran the script you wrote but the attached error appeared

                • 5. Re: Performance Reporting
                  LucD Guru
                  User ModeratorsCommunity WarriorsvExpert

                  Looks like you have a space between $ and metrics.
                  The names of variables should not contain spaces.

                  • 6. Re: Performance Reporting
                    LinaT Novice

                    Hello,

                    Thank you for your quick feedback, Ok ill try again and update you with the result.

                    Thank you

                    • 7. Re: Performance Reporting
                      LinaT Novice

                      Hello,

                      it generated an empty CSV file as before.

                      Thanks

                      • 8. Re: Performance Reporting
                        LucD Guru
                        User ModeratorsCommunity WarriorsvExpert

                        Ok, lets first check if there any VMs in that folder

                        Does this return anything?


                        Get-VM -Location (Get-Folder -Name vm -Location Datacenters)

                         

                        Then we can check if there is statistical data for that period and those VMs.

                         

                        $metrics = "cpu.usage.average", "mem.usage.average", "disk.usage.average"

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


                        Get-VM -Location (Get-Folder -Name vm -Location Datacenters) |

                        ForEach-Object -Process {

                           Get-Stat -Entity $_ -Stat $metrics -Start $start

                        }

                         

                        Does this return anything?

                        • 9. Re: Performance Reporting
                          LinaT Novice

                          Hello,

                           

                          Apologize for the delay,

                           

                          We ran the script, please check the below Outputs,

                           

                          1st script generated output details for the below:

                          Name                 PowerState Num CPUs MemoryGB

                           

                          2nd script returned the below Error (same error for each server):

                          + CategoryInfo          : ResourceUnavailable: ( cpu.usage.average :String) [Get-Stat], VimException

                              + FullyQualifiedErrorId : Client20_RuntimeDataServiceImpl_CheckUserMetrics_MetricDoesntExist,VMware.VimAutomation.

                             ViCore.Cmdlets.Commands.GetViStats

                           

                          Thank you

                          • 10. Re: Performance Reporting
                            LucD Guru
                            User ModeratorsCommunity WarriorsvExpert

                            Ok, so the VM can be found.

                             

                            The 2nd script seems to indicate that this specific metric isn't captured for the VM over that period.

                            Can you check if any of the other metrics is captured with the following?

                             

                            $metrics = "cpu.usage.average", "mem.usage.average", "disk.usage.average"

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


                            Get-VM -Location (Get-Folder -Name vm -Location Datacenters) |

                            ForEach-Object -Process {

                               Get-Stat -Entity $_ -Stat $metrics -Start $start -ErrorAction SilentlyContinue

                            }

                             

                            The problem could be related to the Statistics Levels you defined on your vCenter.

                            Another way to check is to look at the Performance tab for VM and check if there is data available for that period for that specific metric.

                            • 11. Re: Performance Reporting
                              LinaT Novice

                              Yes when we check like manually per server we get the data, will run the latest script you send and will update you with the result.

                               

                              Thank you

                              • 12. Re: Performance Reporting
                                LinaT Novice

                                Hello,

                                 

                                The last script generated a file with CPU, Desk & Memory Usage  but not specified to which server.

                                 

                                Is there something disabled from our side?

                                If not, is there any other way to generate that Bulk Monthly report?

                                 

                                Thank you

                                • 13. Re: Performance Reporting
                                  LucD Guru
                                  Community WarriorsUser ModeratorsvExpert

                                  That last script was to verify that the data for those 3 metrics is available over that time period (30 days).

                                  Did you get data for the full period?
                                  Did you get data for all metrics?

                                  Did you get data for all VMs?

                                  • 14. Re: Performance Reporting
                                    LinaT Novice

                                    Did you get data for the full period?

                                         Yes
                                    Did you get data for all metrics?

                                         I got average usage only for CPU, Desk & Memory --- is there a report to have "System performance, utilization, and capacity"

                                    Did you get data for all VMs?

                                         No, the server part is not available in the output

                                    1 2 Previous Next