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:
Entity | Name | Value |
Host Name | Disk.QFullSampleSize | 32 |
Host Name | Disk.QFullThreshold | 4 |
Host Name | Disk.EnableNaviReg | 0 |
Host Name | Disk.ReqCallThreshold | 30 |
Host Name | VMFS3.UseATSForHBOnVMFS5 | 0 |
Host Name | PSPOptions | IOPS=1 |
Can someone help me please.
That is exactly what the 2nd script is doing.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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
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.
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
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
That is exactly what the 2nd script is doing.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD. It really helped. thanks a ton for your help.