Welcome!
It has been a while since my last post due to a very busy schedule with a SAN and virtualization project.
I have been working on an implementation of a HDS AMS 2500 midrange array for a VMWare vShere 4 environment. So far everything has been working and performing well. The management software included with the HDS AMS 2000 series array is SNM2(Storage Navigator Modular 2), A java based web application. This software also has a command line version which appears to be pretty comprehensive. It consists of a series of DOS executables, which can be run from PowerShell. There are a series of scripts I have been working on for viewing and creating storage resources on the array. I will share many of these in future posts. In this post I want to share some scripts I have written to extend the functionality of the performance monitoring utility in SNM2.
The base functionality of the array allows you to capture performance statistics to a text file. The file can be captured manually or automatically for a specified time period and interval down to one minute. One text file is produced per capture or all captures can be written to one file. Also, I believe based on the information I read in the SNM2 manual you can do some graphing with the web interface, but it requires an additional license and personally I think the PowerGadgets graphs are better.
The 4 scripts I have started with are get-performance_processor.ps1, get-performance_ports.ps1, get-performance_raidgroups.ps1, get-performance_luns.ps1, which do pretty much what they say and produce the following PowerGadgets charts.
The chart group is a tabbed interface which allows you to tab through the controllers and ports/RG/LU/Procs depending on the script being used. Each script generates different groups of charts for different performance counters. I have not implemented all of the performance counters just the ones which are most important to me now. I will be improving these scripts over time and implementing more counters. Here is an example of how the script works.
After executing the script it will ask whether or not to collect data, if yes it will prompt for interval in minutes and time period. If no it will use previously collected data in the default output directory. Next it will ask to list data in text output. Then it will prompt for generation of each group of charts for ports, raid groups, luns or processors depending on the script run.
Now to the script. All of the scripts rely on the start-session.ps1 script and also require a password file be set for logging into the array. Additionally, an array has to be registered.
Example 1 shows a PowerShell script which will register an array and set the admin password.
1 2 3 4 5 6 7 |
$env:STONAVM_HOME="C:Program FilesStorage Navigator Modular 2 CLI" $env:STONAVM_ACT="on" $env:STONAVM_RSP_PASS="on" $env:LANG="en" cd "C:Program FilesStorage Navigator Modular 2 CLI" ./auunitadd -unit ARRAYNAME -ctl0 192.168.1.1 -ctl1 192.168.1.2 ./auaccountenv -set -uid USERNAME |
You will need to replace ARRAYNAME, USERNAME and the IP Addresses for your environment.
Example 2 shows the start-session PowerShell script which defines environmental information.
1 2 3 4 5 6 7 8 9 |
# Comand Enviroment $env:STONAVM_HOME="C:Program FilesStorage Navigator Modular 2 CLI" $env:STONAVM_ACT="on" $env:STONAVM_RSP_PASS="on" $env:LANG="en" # Global $SCRIPTHOME = "C:ScriptsHDS-SNM2" $DEFAULTARRAY = "ARRAYNAME" |
You will need to change the paths and ARRAYNAME for your environment.
Example 3 shows the get-performance_processor.ps1 script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# -- User Defined Constants --------------------------- $LOG_PATH = "C:ScriptsHDS-SNM2pfmlog" # -- Modify controller and core options as needed ----- $Controllers = @(0,1) $cores = @("X","Y") # -- 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 # -- Object to hold processor usage data ------------------------ $allprocusagedata = @() # -- Processing flags ------------------------------------- $PROCUsageDataRead = $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]?)) This script collects the data from the array in separate files. Reads the pertinent data from the files and transforms it into object form which is fed into the PowerGadgets out-chart cmdlet. The other three scripts are longer as they digest more information. To use these scripts you will need PowerShell, PowerGadgets( this a pay product with a free trial ), SNM2 CLI, and the script files attached to this post. Oh and an HDS AMS 2000 array. Here are the script dowmloads <a href="http://muegge.com/blogfiles/start-Session.txt">start-Session.txt</a> <a href="http://muegge.com/blogfiles/get-performance_processor.txt">get-performance_processor.txt</a> <a href="http://muegge.com/blogfiles/get-performance_ports.txt">get-performance_ports.txt</a> <a href="http://muegge.com/blogfiles/get-performance_raidgroups.txt">get-performance_raidgroups.txt</a> <a href="http://muegge.com/blogfiles/get-performance_luns.txt">get-performance_luns.txt</a> Save the files to your script directory and change the extensions to .ps1 I hope someone finds this useful. Regards, Dave ){ $collectfrom = $matches[1] $collectto = $matches[2] } # Get Proc Usage Data if ($line -match 'CTLs+Cores+Usage'){ $PROCUsageDataRead = $TRUE }elseif($PROCUsageDataRead){ $line -match '([0,1]{1})s+([X,Y]{1})s+(d+)' | Out-Null $procusagedata = "" | Select ctl,core,usage,datetime $procusagedata.ctl = $matches[1] $procusagedata.core = $matches[2] $procusagedata.usage = $matches[3] $procusagedata.datetime = $collectto $allprocusagedata += $procusagedata if(($procusagedata.ctl -eq 1) -and ($procusagedata.core -eq "Y")){$PROCUsageDataRead = $FALSE} } } } # -- List Data --------------------------------- Write-Host ”List Processor Data Y or N...” $modekey = $Host.UI.RawUI.ReadKey(”NoEcho,IncludeKeyDown”) if($modekey.Character.ToString().ToLower() -eq "y"){ $allprocusagedata | ft -prop * } # -- Create Processor Usage Chart Group ---------------------- Write-Host ”Show Processor Usage 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($core in $cores){ $ChartTitle = "Processor Usage Controller:$Controller Core:$core" $allprocusagedata | where {($_.core -eq $core)-and ($_.ctl -eq $Controller)} | sort datetime | Select core,usage,datetime | ` Out-Chart -Values usage -Series_0_Text "Processor Usage %" -Label datetime ` -Title $ChartTitle -Gallery Lines -Group "PROCUSAGE" -Name $ChartTitle -Caption "Processor Usage %" } } } Set-Location $SCRIPTHOME |
This script collects the data from the array in separate files. Reads the pertinent data from the files and transforms it into object form which is fed into the PowerGadgets out-chart cmdlet. The other three scripts are longer as they digest more information.
To use these scripts you will need PowerShell, PowerGadgets( this a pay product with a free trial ), SNM2 CLI, and the script files attached to this post. Oh and an HDS AMS 2000 array.
Here are the script dowmloads
start-Session.txt
get-performance_processor.txt
get-performance_ports.txt
get-performance_raidgroups.txt
get-performance_luns.txt
Save the files to your script directory and change the extensions to .ps1
I hope someone finds this useful.
Regards,
Dave