# -- User Defined Constants --------------------------- $LOG_PATH = "C:\Scripts\HDS-SNM2\pfmlog" # Modify raid group and controller options as needed $Controllers = @(0,1) $RaidGroups = @(0,1,2,3,4,5,6,7,9,11,97,98,99) $MAX_RAID_GROUP = 99 # -- 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 raid group data ------------------------ $allrgiopdata = @() $allrgcmddata = @() # -- Processing flags ------------------------------------- $RGIOPDataRead = $FALSE $RGCMDDataRead = $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 RAID Group IOP Data if ($line -match 'CTL\s+RG\s+IO\sRate'){ $RGIOPDataRead = $TRUE }elseif($RGIOPDataRead){ $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 $rgiopdata = "" | Select ctl,rg,iops,readiops,writeiops,readhit,writehit,tranrate,readrate,writerate,datetime $rgiopdata.ctl = $matches[1] $rgiopdata.rg = $matches[2] $rgiopdata.iops = $matches[3] $rgiopdata.readiops = $matches[4] $rgiopdata.writeiops = $matches[5] $rgiopdata.readhit = $matches[6] $rgiopdata.writehit = $matches[7] $rgiopdata.tranrate = $matches[8] $rgiopdata.readrate = $matches[9] $rgiopdata.writerate = $matches[10] $rgiopdata.datetime = $collectto $allrgiopdata += $rgiopdata if(($rgiopdata.ctl -eq 1) -and ($rgiopdata.rg -eq $MAX_RAID_GROUP)){$RGIOPDataRead = $FALSE} } # Get RG CMD Data if ($line -match 'CTL\s+RG\s+Read\sCMD\sCount'){ $RGCMDDataRead = $TRUE }elseif($RGCMDDataRead){ $line -match '([0,1]{1})\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)' | Out-Null $rgcmddata = "" | Select ctl,rg,readcmdcount,writecmdcount,readcmdhitcount,writecmdhitcount,readsize,writesize,datetime $rgcmddata.ctl = $matches[1] $rgcmddata.rg = $matches[2] $rgcmddata.readcmdcount = $matches[3] $rgcmddata.writecmdcount = $matches[4] $rgcmddata.readcmdhitcount = $matches[5] $rgcmddata.writecmdhitcount = $matches[6] $rgcmddata.readsize = $matches[7] $rgcmddata.writesize = $matches[8] $rgcmddata.datetime = $collectto $allrgcmddata += $rgcmddata if(($rgcmddata.ctl -eq 1) -and ($rgcmddata.rg -eq $MAX_RAID_GROUP)){$RGCMDDataRead = $FALSE} } } } # -- List Data --------------------------------- Write-Host ”List Raid Group Data Y or N...” $modekey = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”) if($modekey.Character.ToString().ToLower() -eq "y"){ $allrgiopdata | ft -prop * $allrgcmddata | ft -prop * } # -- Create RG IOPS Chart Group ---------------------- Write-Host ”Show RG 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($RaidGroup in $RaidGroups){ $ChartTitle = "IOPS for Controller:$Controller Raid Group:$RaidGroup" $allrgiopdata | where {($_.rg -eq $RaidGroup)-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 "Raid Group IOPS" -Series_1_Text "Raid Group Read IOPS" -Series_2_Text "Raid Group Write IOPS" -Label datetime ` -Title $ChartTitle -Gallery Lines -Group "RAIDGROUPIOPS" -Name $ChartTitle -Caption "Raid Group IOPS" } } } # -- Create RG Cache Hit Chart Group ----------------- Write-Host ”Show RG Cache Hits 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($RaidGroup in $RaidGroups){ $ChartTitle = "Cache Hits for Controller:$Controller Raid Group:$RaidGroup" $allrgiopdata | where {($_.rg -eq $RaidGroup)-and ($_.ctl -eq $Controller)} | sort datetime | Select iops,readiops,writeiops,readhit,writehit,tranrate,readrate,writerate,datetime | ` Out-Chart -Values readhit,writehit -Series_0_Text "Raid Group Read Hit %" -Series_1_Text "Raid Group Write Hit %" -Label datetime ` -Title $ChartTitle -Gallery Lines -Group "RGCACHE" -Name $ChartTitle -Caption "Raid Group Cache Hits" } } } # -- Create RG Transaction Rate Chart Group --------------- Write-Host ”Show RG Transaction Rate 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($RaidGroup in $RaidGroups){ $ChartTitle = "Transaction Rate for Controller:$Controller Raid Group:$RaidGroup" $allrgiopdata | where {($_.rg -eq $RaidGroup)-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 "RG Transaction Rate (MB/S)" -Series_1_Text "RG Transaction Read Rate (MB/S)" -Series_2_Text "RG Transaction Write Rate (MB/S)" ` -Label datetime -Title $ChartTitle -Gallery Lines -Group "RGTRANSACTIONRATE" -Name $ChartTitle -Caption "RG Transaction Rate" } } } # -- Create RG Transaction Size Chart Group --------------- Write-Host ”Show RG Transaction Size 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($RaidGroup in $RaidGroups){ $ChartTitle = "Transaction Size for Controller:$Controller Raid Group:$RaidGroup" $allrgcmddata | where {($_.rg -eq $RaidGroup)-and ($_.ctl -eq $Controller)} | sort datetime | Select readcmdcount,writecmdcount,readcmdhitcount,writecmdhitcount,readsize,writesize,datetime | ` Out-Chart -Values readsize,writesize -Series_0_Text "RG Transaction Read Size (MB)" -Series_1_Text "RG Transaction Write Size (MB)" ` -Label datetime -Title $ChartTitle -Gallery Lines -Group "RGTRANSACTIONSIZE" -Name $ChartTitle -Caption "RG Transaction Size" } } } # -- Create RG Command Chart Group --------------- Write-Host ”Show RG Commands 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($RaidGroup in $RaidGroups){ $ChartTitle = "Commands for Controller:$Controller Raid Group:$RaidGroup" $allrgcmddata | where {($_.rg -eq $RaidGroup)-and ($_.ctl -eq $Controller)} | sort datetime | Select readcmdcount,writecmdcount,readcmdhitcount,writecmdhitcount,readsize,writesize,datetime | ` Out-Chart -Values readcmdcount,writecmdcount,readcmdhitcount,writecmdhitcount -Series_0_Text "RG Read Command Count" -Series_1_Text "RG Write Command Count" -Series_2_Text "RG Read Command Hit Count" -Series_3_Text "RG Write Command Hit Count" ` -Label datetime -Title $ChartTitle -Gallery Lines -Group "RGCOMMANDS" -Name $ChartTitle -Caption "Raid Group Commands" } } } Set-Location $SCRIPTHOME