12 Replies Latest reply on Jul 1, 2020 12:37 PM by NWolford51

    DatastoreCluster Reporting

    NWolford51 Novice

      Hey all,

       

      Is it possible to report on all the datastores that are in the cluster?  For instance, we have a Datastore Cluster that has 16 datastores inside of it.  I want to traverse by each cluster and get results for the entire Datastore Cluster and not each individual datastore.  This is what I have been using but it returns every single datastore. 

       

      javascript:;Get-Datastore  |
      Select @{N='Datacenter';E={$_.Datacenter.Name}},
          @{N='DSC';E={Get-DatastoreCluster -Datastore $_ | Select -ExpandProperty Name}}, 
          Name,CapacityGB,@{N='FreespaceGB';E={[math]::Round($_.FreespaceGB,2)}},
          @{N='ProvisionedSpaceGB';E={[math]::Round(($_.ExtensionData.Summary.Capacity - $_.Extensiondata.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2)}},
          @{N='UnCommittedGB';E={[math]::Round($_.ExtensionData.Summary.Uncommitted/1GB,2)}},
          @{N='VM';E={$_.ExtensionData.VM.Count}} | Format-Table -AutoSize
      
        • 1. Re: DatastoreCluster Reporting
          NWolford51 Novice

          I am looking to report on the following of an all the datastores in a datastorecluster in each specific datacenter cluster:

           

          Capacity, FreeSpace, VM's, PercentFree and UncomittedSpace

          • 2. Re: DatastoreCluster Reporting
            LucD Guru
            User ModeratorsvExpertCommunity Warriors

            Try something like this

             

            Get-DatastoreCluster -PipelineVariable dsc |

            Get-Datastore  |

            Select @{N='Datacenter';E={$_.Datacenter.Name}},

                @{N='DSC';E={$dsc.Name}}, 

                Name,CapacityGB,@{N='FreespaceGB';E={[math]::Round($_.FreespaceGB,2)}},

                @{N='ProvisionedSpaceGB';E={[math]::Round(($_.ExtensionData.Summary.Capacity - $_.Extensiondata.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2)}},

                @{N='UnCommittedGB';E={[math]::Round($_.ExtensionData.Summary.Uncommitted/1GB,2)}},

                @{N='VM';E={$_.ExtensionData.VM.Count}} | Format-Table -AutoSize

            Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
            • 3. Re: DatastoreCluster Reporting
              NWolford51 Novice

              Thanks for the quick reply!

               

              So, that is similar to what I was getting with my script.  I am trying to find a way to report on the cluster as a whole instead of each individual datastore.

               

              Datacenter   DSC                                                                        Name                                                        CapacityGB     FreespaceGB    ProvisionedSpaceGB     UnCommittedGB VM

              ANF              ANF-CUC01-PR_VPLEX0146-SG01-local            ANF_VPLEX0146_SG01_D89C_local     4095.75           1999.21             2473.14                           376.6 13

              ANF              ANF-CUC01-PR_VPLEX0146-SG01-local            ANF_VPLEX0146_SG01_D89B_local     4095.75            2076.83            2574.81                            555.89 16

               

               

              So, instead of reporting each individual name (ANF_VPLEX0146_SG01_D89C_local , ANF_VPLEX0146_SG01_D89B_local ) I would like to report on the DSC only (ANF-CUC01-PR_VPLEX0146-SG01-local).  Is that possible? 

              • 4. Re: DatastoreCluster Reporting
                LucD Guru
                Community WarriorsvExpertUser Moderators

                Something like this?

                 

                Get-Datacenter -PipelineVariable dc |

                Get-DatastoreCluster -PipelineVariable dsc |

                ForEach-Object -Process {

                    $ds = Get-Datastore -RelatedObject $dsc

                    '' | Select @{N='Datacenter';E={$dc.Name}},

                        @{N='DSC';E={$dsc.Name}},

                        @{N='CapacityGB';E={($ds | Measure-Object -Property CapacityGB -Sum).Sum}},

                        @{N='ProvisionedSpaceGB';E={

                            [math]::Round((($ds.ExtensionData.Summary.Capacity | Measure-Object -Sum).Sum -

                            ($ds.Extensiondata.Summary.FreeSpace | Measure-Object -Sum).Sum +

                            ($ds.ExtensionData.Summary.Uncommitted | Measure-Object -Sum).Sum)/1GB,2)}},

                        @{N='UnCommittedGB';E={[math]::Round(($ds.ExtensionData.Summary.Uncommitted | Measure-Object -Sum).Sum/1GB,2)}},

                        @{N='VM';E={($ds.ExtensionData.VM.Count | Measure-Object -Sum).Sum}}

                }

                Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                1 person found this helpful
                • 5. Re: DatastoreCluster Reporting
                  NWolford51 Novice

                  LucD,

                   

                  Thank you.  THat is exactly where I was trying to go with it.  Appreciate your help.

                  • 6. Re: DatastoreCluster Reporting
                    NWolford51 Novice

                    One final question, is it possible to get this in a table with only one header and all the datastore clusters reported underneath that one header?  Right now they each have their own individual header.

                    • 7. Re: DatastoreCluster Reporting
                      LucD Guru
                      vExpertUser ModeratorsCommunity Warriors

                      Not sure I'm following.
                      Can you show what you see and what you would like to see?

                      Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                      • 8. Re: DatastoreCluster Reporting
                        NWolford51 Novice

                        We are pulling the correct information now:

                        Datacenter DSC                                CapacityGB ProvisionedSpaceGB UnCommittedGB VM

                        ---------- ---                                ---------- ------------------ ------------- --

                        ANF        ANF-CORP01-PR_VPLEX0146-SG01-local     8191.5            5673.96       4027.98 19

                         

                        Datacenter DSC                             CapacityGB ProvisionedSpaceGB UnCommittedGB VM

                        ---------- ---                             ---------- ------------------ ------------- --

                        ANF        ANF-OCP-PR_VPLEX0146-SG01-local     8191.5            8799.54       4524.36 51

                         

                        Datacenter DSC                                CapacityGB ProvisionedSpaceGB UnCommittedGB VM

                        ---------- ---                                ---------- ------------------ ------------- --

                        ANF        ANF-CORP03-PR_VPLEX0146-SG01-local    16383.5           17313.76       7463.81 95

                         

                        Datacenter DSC                                CapacityGB ProvisionedSpaceGB UnCommittedGB  VM

                        ---------- ---                                ---------- ------------------ -------------  --

                        ANF        ANF-CORP02-PR_VPLEX0146-SG01-local      98300          106395.87      36365.22 608

                         

                        But is it possible to format it like below:

                         

                        Datacenter DSC                                CapacityGB ProvisionedSpaceGB UnCommittedGB VM

                        ---------- ---                                ---------- ------------------ ------------- --

                        ANF        ANF-CORP01-PR_VPLEX0146-SG01-local     8191.5            5673.96       4027.98 19

                         

                        ANF        ANF-OCP-PR_VPLEX0146-SG01-local     8191.5            8799.54       4524.36 51

                         

                        ANF        ANF-CORP03-PR_VPLEX0146-SG01-local    16383.5           17313.76       7463.81 95

                         

                        ANF        ANF-CORP02-PR_VPLEX0146-SG01-local      98300          106395.87      36365.22 608

                         

                         

                        That way the header is on the top line and then ll data below that.

                        • 9. Re: DatastoreCluster Reporting
                          LucD Guru
                          vExpertCommunity WarriorsUser Moderators

                          Ok, try like this

                           

                          $report = @()

                          Get-Datacenter -PipelineVariable dc |

                          Get-DatastoreCluster -PipelineVariable dsc |

                          ForEach-Object -Process {

                              $ds = Get-Datastore -RelatedObject $dsc

                              $report += '' | Select @{N='Datacenter';E={$dc.Name}},

                                  @{N='DSC';E={$dsc.Name}},

                                  @{N='CapacityGB';E={($ds | Measure-Object -Property CapacityGB -Sum).Sum}},

                                  @{N='ProvisionedSpaceGB';E={

                                      [math]::Round((($ds.ExtensionData.Summary.Capacity | Measure-Object -Sum).Sum -

                                      ($ds.Extensiondata.Summary.FreeSpace | Measure-Object -Sum).Sum +

                                      ($ds.ExtensionData.Summary.Uncommitted | Measure-Object -Sum).Sum)/1GB,2)}},

                                  @{N='UnCommittedGB';E={[math]::Round(($ds.ExtensionData.Summary.Uncommitted | Measure-Object -Sum).Sum/1GB,2)}},

                                  @{N='VM';E={($ds.ExtensionData.VM.Count | Measure-Object -Sum).Sum}}

                          }

                          $report

                          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                          • 10. Re: DatastoreCluster Reporting
                            NWolford51 Novice

                            That changed the formatting to more of a list structure.  I tried to add "| Format_Table -Autosize" to the end but each Datastore Cluster still had its own header.

                             

                            Datacenter         : ANF

                            DSC                : ANF-ECOM02-PR_VPLEX0146-SG01-local

                            CapacityGB         : 8191

                            ProvisionedSpaceGB : 557.21

                            UnCommittedGB      : 76.15

                            VM                 : 1

                             

                             

                            Datacenter         : ANF

                            DSC                : ANF-DMZ01-PR_VPLEX0146-SG01-local

                            CapacityGB         : 8191.5

                            ProvisionedSpaceGB : 10105.74

                            UnCommittedGB      : 4657.87

                            VM                 : 74

                             

                             

                            Datacenter         : ANF

                            DSC                : ANF-CUC01-PR_VPLEX0146-SG01-local

                            CapacityGB         : 8191.5

                            ProvisionedSpaceGB : 5047.79

                            UnCommittedGB      : 932.49

                            VM                 : 29

                            • 11. Re: DatastoreCluster Reporting
                              LucD Guru
                              User ModeratorsvExpertCommunity Warriors

                              The format you see on screen is determined by many factors.

                              In this case, the fact that there are more than 5 properties made the PowerShell output formatter decide to go for the Format-List format.

                               

                              Not sure where you added the Format-Table, but this seems to work for me.

                               

                              $report = @()

                              Get-Datacenter -PipelineVariable dc |

                              Get-DatastoreCluster -PipelineVariable dsc |

                              ForEach-Object -Process {

                                  $ds = Get-Datastore -RelatedObject $dsc

                                  $report += '' | Select @{N='Datacenter';E={$dc.Name}},

                                      @{N='DSC';E={$dsc.Name}},

                                      @{N='CapacityGB';E={($ds | Measure-Object -Property CapacityGB -Sum).Sum}},

                                      @{N='ProvisionedSpaceGB';E={

                                          [math]::Round((($ds.ExtensionData.Summary.Capacity | Measure-Object -Sum).Sum -

                                          ($ds.Extensiondata.Summary.FreeSpace | Measure-Object -Sum).Sum +

                                          ($ds.ExtensionData.Summary.Uncommitted | Measure-Object -Sum).Sum)/1GB,2)}},

                                      @{N='UnCommittedGB';E={[math]::Round(($ds.ExtensionData.Summary.Uncommitted | Measure-Object -Sum).Sum/1GB,2)}},

                                      @{N='VM';E={($ds.ExtensionData.VM.Count | Measure-Object -Sum).Sum}}

                              }

                              $report | Format-Table -AutoSize

                              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                              1 person found this helpful
                              • 12. Re: DatastoreCluster Reporting
                                NWolford51 Novice

                                Yes, that works perfectly.  I had it on the last line of code and not behind the $report.  Thanks again LucD!