# -- User Defined Constants --------------------------- $LOG_PATH = "C:\Scripts\HDS-SNM2\pfmlog" # Modify raid group and controller options as needed $Controllers = @(0,1) $luns = @(0..23) $maxlunum = 23 # -- Modifications below this line should not be required --------------------------------------- # -- Setup environment ------------------------------ $testsnapin = $null $testsnapin = get-pssnapin | where { $_.Name -eq "PowerGadgets"} if(-not $testsnapin){add-pssnapin -Name PowerGadgets} . ./start-session.ps1 Set-Location $env:STONAVM_HOME # -- Objects to hold lu data ------------------------ $allluiopdata = @() $alllucmddata = @() # -- Processing flags ------------------------------------- $LUIOPDataRead = $FALSE $LUCMDDataRead = $FALSE # Specify whether to run new collection if not existing files are used Write-Host ”Collect Data Y or N...” $modekey = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”) if($modekey.Character.ToString().ToLower() -eq "y"){ $collectiontime = Read-Host "Collection Time/Count in minutes" Write-Host "Collecting Data..." ./auperform.exe -unit $DEFAULTARRAY -auto 1 -count $collectiontime -path $LOG_PATH -pfmstatis } # Get data from files Write-Host "Analyzing Data..." $perffiles = Get-ChildItem $LOG_PATH foreach($perffile in $perffiles){ $filedata = Get-Content $LOG_PATH\$perffile foreach($line in $filedata){ # Get collection times if($line -match '^(\d{4}\/(?:0[1-9]|1[0-2]?)\/(?:0[1-9]|[12][0-9]|3[01]?)\s(?:0[0-9]|1[0-9]|2[0-3]?)\:(?:0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]?)\:(?:0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]?))\s-\s(\d{4}\/(?:0[1-9]|1[0-2]?)\/(?:0[1-9]|[12][0-9]|3[01]?)\s(?:0[0-9]|1[0-9]|2[0-3]?)\:(?:0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]?)\:(?:0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]?))$'){ $collectfrom = $matches[1] $collectto = $matches[2] } # Get LUN IOP Data if ($line -match 'CTL\s+LU\s+IO\sRate'){ $LUIOPDataRead = $TRUE }elseif($LUIOPDataRead){ $line -match '([0,1]{1})\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)' | Out-Null $luiopdata = "" | Select ctl,lu,iops,readiops,writeiops,readhit,writehit,tranrate,readrate,writerate,datetime $luiopdata.ctl = $matches[1] $luiopdata.lu = $matches[2] $luiopdata.iops = $matches[3] $luiopdata.readiops = $matches[4] $luiopdata.writeiops = $matches[5] $luiopdata.readhit = $matches[6] $luiopdata.writehit = $matches[7] $luiopdata.tranrate = $matches[8] $luiopdata.readrate = $matches[9] $luiopdata.writerate = $matches[10] $luiopdata.datetime = $collectto $allluiopdata += $luiopdata if(($luiopdata.ctl -eq 1) -and ($luiopdata.lu -eq $maxlunum)){$LUIOPDataRead = $FALSE} } # Get RG CMD Data if ($line -match 'CTL\s+LU\s+Read\sCMD\sCount'){ $LUCMDDataRead = $TRUE }elseif($LUCMDDataRead){ $line -match '([0,1]{1})\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)' | Out-Null $lucmddata = "" | Select ctl,lu,readcmdcount,writecmdcount,readcmdhitcount,writecmdhitcount,readsize,writesize,datetime $lucmddata.ctl = $matches[1] $lucmddata.lu = $matches[2] $lucmddata.readcmdcount = $matches[3] $lucmddata.writecmdcount = $matches[4] $lucmddata.readcmdhitcount = $matches[5] $lucmddata.writecmdhitcount = $matches[6] $lucmddata.readsize = $matches[7] $lucmddata.writesize = $matches[8] $lucmddata.datetime = $collectto $alllucmddata += $lucmddata if(($lucmddata.ctl -eq 1) -and ($lucmddata.lu -eq $maxlunum)){$LUCMDDataRead = $FALSE} } } } # -- List Data --------------------------------- Write-Host ”List LU Data Y or N...” $modekey = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”) if($modekey.Character.ToString().ToLower() -eq "y"){ $allluiopdata | ft -prop * $alllucmddata | ft -prop * } # -- Create LU IOPS Chart Group ---------------------- Write-Host ”Show LU IOPS Charts Y or N...” $modekey = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”) if($modekey.Character.ToString().ToLower() -eq "y"){ Write-Host "Generating Charts..." foreach($Controller in $Controllers){ foreach($lun in $luns){ $ChartTitle = "IOPS for Controller:$Controller LU:$lun" $allluiopdata | where {($_.lu -eq $lun)-and ($_.ctl -eq $Controller)} | sort datetime | Select iops,readiops,writeiops,readhit,writehit,tranrate,readrate,writerate,datetime | ` Out-Chart -Values iops,readiops,writeiops -Series_0_Text "LU IOPS" -Series_1_Text "LU Read IOPS" -Series_2_Text "LU Write IOPS" -Label datetime ` -Title $ChartTitle -Gallery Lines -Group "LUNIOPS" -Name $ChartTitle -Caption "LU IOPS" } } } # -- Create LU Cache Hit Chart Group ----------------- Write-Host ”Show LU Cache Hit Charts Y or N...” $modekey = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”) if($modekey.Character.ToString().ToLower() -eq "y"){ Write-Host "Generating Charts..." foreach($Controller in $Controllers){ foreach($lun in $luns){ $ChartTitle = "Cache Hits for Controller:$Controller LU:$lun" $allluiopdata | where {($_.lu -eq $lun)-and ($_.ctl -eq $Controller)} | sort datetime | Select iops,readiops,writeiops,readhit,writehit,tranrate,readrate,writerate,datetime | ` Out-Chart -Values readhit,writehit -Series_0_Text "LU Read Hit %" -Series_1_Text "LU Write Hit %" -Label datetime ` -Title $ChartTitle -Gallery Lines -Group "LUCACHE" -Name $ChartTitle -Caption "LU Cache Hits" } } } # -- Create LU Transaction Rate Chart Group -------- Write-Host ”Show LU Transaction Rate Charts Y or N...” $modekey = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”) if($modekey.Character.ToString().ToLower() -eq "y"){ Write-Host "Generating Charts..." foreach($Controller in $Controllers){ foreach($lun in $luns){ $ChartTitle = "Transaction Rate for Controller:$Controller LU:$lun" $allluiopdata | where {($_.lu -eq $lun)-and ($_.ctl -eq $Controller)} | sort datetime | Select iops,readiops,writeiops,readhit,writehit,tranrate,readrate,writerate,datetime | ` Out-Chart -Values tranrate,readrate,writerate -Series_0_Text "LU Transaction Rate (MB/S)" -Series_1_Text "LU Transaction Read Rate (MB/S)" -Series_2_Text "LU Transaction Write Rate (MB/S)" ` -Label datetime -Title $ChartTitle -Gallery Lines -Group "LUTRANSACTIONRATE" -Name $ChartTitle -Caption "LU Transaction Rate" } } } # -- Create LU Transaction Size Chart Group --------------- Write-Host ”Show LU Transaction Size Charts Y or N...” $modekey = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”) if($modekey.Character.ToString().ToLower() -eq "y"){ Write-Host "Generating Charts..." foreach($Controller in $Controllers){ foreach($lun in $luns){ $ChartTitle = "Transaction Size for Controller:$Controller LU:$lun" $alllucmddata | where {($_.lu -eq $lun)-and ($_.ctl -eq $Controller)} | sort datetime | Select readcmdcount,writecmdcount,readcmdhitcount,writecmdhitcount,readsize,writesize,datetime | ` Out-Chart -Values readsize,writesize -Series_0_Text "LU Transaction Read Size (MB)" -Series_1_Text "LU Transaction Write Size (MB)" ` -Label datetime -Title $ChartTitle -Gallery Lines -Group "LUTRANSACTIONSIZE" -Name $ChartTitle -Caption "LU Transaction Size" } } } # -- Create LU Command Chart Group --------------- Write-Host ”Show LU Command Charts Y or N...” $modekey = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”) if($modekey.Character.ToString().ToLower() -eq "y"){ Write-Host "Generating Charts..." foreach($Controller in $Controllers){ foreach($lun in $luns){ $ChartTitle = "Commands for Controller:$Controller LU:$lun" $alllucmddata | where {($_.lu -eq $lun)-and ($_.ctl -eq $Controller)} | sort datetime | Select readcmdcount,writecmdcount,readcmdhitcount,writecmdhitcount,readsize,writesize,datetime | ` Out-Chart -Values readcmdcount,writecmdcount,readcmdhitcount,writecmdhitcount -Series_0_Text "LU Read Command Count" -Series_1_Text "LU Write Command Count" -Series_2_Text "LU Read Command Hit Count" -Series_3_Text "LU Write Command Hit Count" ` -Label datetime -Title $ChartTitle -Gallery Lines -Group "LUCOMMANDS" -Name $ChartTitle -Caption "LU Commands" } } } Set-Location $SCRIPTHOME