AnkurS11
Contributor
Contributor

List Advanced setting configured on Hosts and IOPS=1 value form the $esxcli.storage.nmp.satp.rule.list() Rule

Jump to solution

HI All,

I have created a script the List down the advanced settings configured on the number of Hosts in the VC. Below are the vaules i need to find out form the ESXi hosts.

    QFullSampleSize = 32

   QFullThreshold = 4

   IOPS = 1

   disable ATS hearbeat

   EnableNaviReg = 0

   ReqCallThreshold = 30

Below is the script i created

$VC = read-host "Please enter vCenter Name"

connect-viserver $VC

$esxHosts = Get-VMHost | Sort Name

$esxcli = Get-EsxCli -VMHost $esxHosts

foreach($esx in $esxHosts)

{

     Get-AdvancedSetting -Entity $esx -Name Disk.QFullSampleSize | Select Entity,Name,Value | Export-CSV -NoTypeInformation -Append -path c:\scripts\ADSettings.csv

     Get-AdvancedSetting -Entity $esx -Name Disk.QFullThreshold| Select Entity,Name,Value | Export-CSV -NoTypeInformation -Append -path c:\scripts\ADSettings.csv

     Get-AdvancedSetting -Entity $esx -Name Disk.EnableNaviReg| Select Entity,Name,Value | Export-CSV -NoTypeInformation -Append -path c:\scripts\ADSettings.csv

     Get-AdvancedSetting -Entity $esx -Name Disk.ReqCallThreshold| Select Entity,Name,Value | Export-CSV -NoTypeInformation -Append -path c:\scripts\ADSettings.csv

     Get-AdvancedSetting -Entity $esx -Name VMFS3.UseATSForHBOnVMFS5 | Select Entity,Name,Value | Export-CSV -NoTypeInformation -Append -path c:\scripts\ADSettings.csv

      $esxcli.storage.nmp.satp.rule.list()| select PSPOptions, @{Name="ESXihost" ; Expression = {$esxHosts}}

  

#}

    Write-Host

   Write-Host "Done.  Check the c:\scripts\ADSettings.csv file now." -ForegroundColor Green

For the above Get-AdvancedSetting i am getting the correct output in Excel but not able to get the correct output for  $esxcli.storage.nmp.satp.rule.list() in EXcel along with the above values.

I ran the below command separately with 2 methods but i am not getting one liner command.

METHOD 1:

PS C:\Windows\system32> $esxcli.storage.nmp.satp.rule.list()| select PSPOptions, @{Name="ESXihost" ; Expression = {$esxHosts}}

OUTPUT:-

PSPOptions                                                                      ESXihost                                                                      

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

                                                                                Host Name                                                 

                                                                                Host Name

                                                                                Host Name                                                 

                                                                                Host Name                                                 

                                                                                Host Name                                                 

                                                                                Host Name

                                                                                Host Name                                                 

                                                                                Host Name 

                                                                                Host Name 

                                                                                Host Name                                                 

iops=1                                                                     Host Name                                                 

                                                                                Host Name                                                 

                                                                                Host Name                                                 

                                                                                Host Name                                                

                                                                                Host Name                                                 

                                                                                Host Name                                                 

                                                                                Host Name                                                

                                                                                Host Name

                                                                                Host Name

METHOD 2:

PS C:\Windows\system32> $esxcli.storage.nmp.satp.rule.list()| where {$_.PSPOptions -eq "iops=1"}

OUTPUT:-

ClaimOptions :

DefaultPSP   : VMW_PSP_RR

Description  :

Device       :

Driver       :

Model        : XtremApp

Name         : VMW_SATP_DEFAULT_AA

Options      :

PSPOptions   : iops=1

RuleGroup    : system

Transport    :

Vendor       : XtremIO

Whereas I wanted an output in the below manner:

   

EntityNameValue
Host NameDisk.QFullSampleSize32
Host NameDisk.QFullThreshold4
Host NameDisk.EnableNaviReg0
Host NameDisk.ReqCallThreshold30
Host NameVMFS3.UseATSForHBOnVMFS50
Host NamePSPOptionsIOPS=1

Can someone help me please.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

That is exactly what the 2nd script is doing.


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

View solution in original post

0 Kudos
6 Replies
LucD
Leadership
Leadership

Not sure what you want to capture.
There are many PSP rules for all kinds of devices and types, and only some of these rules have PSPOptions set to 'iops=1'.

Are you looking for a specific rule/device/model?


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

0 Kudos
AnkurS11
Contributor
Contributor

I wanted get the IPOS value for 3PAR storage which should be 1. The 3PAR storage recommended it to be set as 1 so i wanted to check whether this value is set correctly on all the host in the VC.

0 Kudos
LucD
Leadership
Leadership

Ok, if you added the PSP rule for the 3PAR storage as specified in HPE 3PAR StoreServ Storage and VMware vSphere 6.5 best practices, page 9,

which is done like this btw

Get-VMHost | ForEach-Object -Process {

    $esxcli = Get-EsxCli -VMHost $_ -V2

    $3Par = @{

        pspoption = 'iops=1'

        satp = 'VMW_SATP_ALUA'

        psp = 'VMW_PSP_RR'

        claimoption = 'tpgs_on'

        vendor = '3PARdata'

        model = 'VV'

        description = '“HPE 3PAR Custom Rule'

    }

    $esxcli.storage.nmp.satp.rule.add.Invoke($3Par)

}

You should be able to list the PSPOptions like this

Get-VMHost | ForEach-Object -Process {

    $esxcli = Get-EsxCli -VMHost $_ -V2

    "" | Select @{N='VMHost';E={$esxcli.VMHost.Name}},

        @{N='PSPOptions';E={

            $esxcli.storage.nmp.satp.rule.list.Invoke() |

            where{$_.Vendor -eq '3PARdata' -and $_.Model -eq 'VV'} |

            sELECT -ExpandProperty PSPOptions

        }}

}


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

0 Kudos
AnkurS11
Contributor
Contributor

can i get output like below in a single row for each host. instead of  values satp,psp,claimoption,vendor, model and description

VMHOST Name          PSPOptions

XYZ                                IOPS=1

0 Kudos
LucD
Leadership
Leadership

That is exactly what the 2nd script is doing.


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

View solution in original post

0 Kudos
AnkurS11
Contributor
Contributor

Thanks LucD. It really helped. thanks a ton for your help.

0 Kudos