I appreciate the positive feedback I have received from the VNXePerformance module so far. I thought I would add to it and provide a script to generate a basic report. The script can be downloaded here.
The script will produce an HTML report and associated graphics with the following information.
-
Capacity Information system and pools(Total and Allocated)
- Maximum, Minimum, Average, Median
- Historical graphs for system and each pool
-
Bandwidth usage per protocol
- Maximum, Minimum, Average, Median
- Historical graphs
-
IOPS usage per protocol
- Maximum, Minimum, Average, Median
- Historical graphs
The previous post used PowerGadgets for the charting functionality. This tool is not free and it is also not yet supported with PowerShell 3.0. To correct this issue I provided a function in this reporting script which uses the charting functionality in the .Net 4.0 framework. While this fixes the two issues mentioned it does require more work to use, but it will work well for our purposes here. This script uses the VNXePerformance.ps1 module from my previous post and a few new functions to produce an html report and associated graphic files. A command line example to run the script is shown below.
1 |
Start-VNXeHTMLPerformanceReport.ps1 –SQLiteDBLocation “c:TmpDM” –VNXeReportOutputLocation “c:TmpRPT” –HTMLReportName |
The script uses data provided by the VNXePerformance module and the functions in the script to format and write the report data. Here is a brief description of the functions used.
Out-DataTable – this function is used to convert the PSObject data provided as output from the module functions to the system.data.datatable type. This is required for databinding to produce charts.
Out-LineChart – This function provides chart generating functionality to produce a line chart based on provided datatable and generate a .png graphic file.
Get-SeriesRollup – This function creates summary data (maximum, minimum, average, median) for series data.
The following functions create HTML report output
- ConvertTo-SeriesRollupHTML
- Write-ChartHTML
- Write-BlankHTMLTable
- Write-HeaderHTMLTable
The first part of the script defines parameters, loads charting assembly, contains the functions declarations and module import.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Param([String]$SQLiteDBLocation="C:TempDB",[String]$VNXeReportOutputLocation="C:Temp",[String]$HTMLReportName="VNXeReport.html") # Load the charting assembly [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization") # Imports Import-Module -Name VNXePerformance function Out-DataTable… function Out-LineChart… function Get-SeriesRollup… function ConvertTo-SeriesRollupHTML… function Write-ChartHTML… function Write-BlankHTMLTable… function Write-HeaderHTMLTable… |
The next portion of the sets the location of the SQLite database and begins the HTML report string.
1 2 3 4 5 6 7 8 9 10 11 12 |
# Set DB Location Set-VNXeSQLiteLocation -Path $SQLiteDBLocation # Open HTML Document $HTMLReportText = "<html><body>" # Capacity $VNXeSystemTotalsDetail = Get-VNXeSystemTotalsDetail $LastSystemTotalSpace = $VNXeSystemTotalsDetail | select total_space -Last 1 $LastSystemTotalSpaceGB = $LastSystemTotalSpace.total_space / 1024 / 1024 / 1024 $HTMLTemp = "<table><tr><td>System Total Usable Space GB: </td><td>" + $LastSystemTotalSpaceGB + "</td></tr></table>" $HTMLReportText += $HTMLTemp |
The next portion of the script completes the report by using the VNXePerformance module to retrieve object data then output HTML using the script functions.
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 |
# System Space $HTMLReportText += Write-BlankHTMLTable $HTMLReportText += Write-HeaderHTMLTable "System Allocated Space Rollup" $SystemAllocatedRollup = Get-SeriesRollup -InputObject $VNXeSystemTotalsDetail -Property "allocated_space" $HTMLReportText += ConvertTo-SeriesRollupHTML -InputObject $SystemAllocatedRollup # Capacity Charts $HTMLReportText += Write-BlankHTMLTable $ChartFullPath = $VNXeReportOutputLocation + "VNXeDiskSpace.png" $VNXeSystemTotalsDetail | Out-LineChart -YValues "allocated_space,total_space" -XValue "timestamp" -Width 800 -Height 600 -ChartTitle "Historical Disk Space" -ChartType "png" -ChartFullPath $ChartFullPath $HTMLReportText += Write-ChartHTML $ChartFullPath # Pool Space Charts $VNXePoolsDetail = Get-VNXePoolsDetail $HTMLReportText += Write-BlankHTMLTable $ExtremePoolDetail = $VNXePoolsDetail | Where {$_.pool_id -eq "extreme_performance"} $ChartFullPath = $VNXeReportOutputLocation + "VNXeExtremePoolDiskSpace.png" $ExtremePoolDetail | Out-LineChart -YValues "allocated_space,total_space" -XValue "timestamp" -Width 800 -Height 600 -ChartTitle "Historical Disk Space - Extreme Performance Pool" -ChartType "png" -ChartFullPath $ChartFullPath $HTMLReportText += Write-ChartHTML $ChartFullPath . . . # SPB $HTMLReportText += Write-BlankHTMLTable $HTMLReportText += Write-HeaderHTMLTable "Flare SPB Read IO/Sec Rollup" $FlareSPBIORollup = Get-SeriesRollup -InputObject $VNXeBasicSummaryFlareSPBDetail -Property LUNDiskReadsPerSec $HTMLReportText += ConvertTo-SeriesRollupHTML -InputObject $FlareSPBIORollup $HTMLReportText += Write-HeaderHTMLTable "Flare SPB Write IO/Sec Rollup" $FlareSPBIORollup = Get-SeriesRollup -InputObject $VNXeBasicSummaryFlareSPBDetail -Property LUNDiskWritesPerSec $HTMLReportText += ConvertTo-SeriesRollupHTML -InputObject $FlareSPBIORollup $ChartFullPath = $VNXeReportOutputLocation + "VNXeFlareSPBIOPerSec.png" $VNXeBasicSummaryFlareSPBDetail | Out-Linechart -YValues "LUNDiskReadsPerSec,LUNDiskWritesPerSec" -Xvalue "stored_timestamp" -Width 800 -Height 600 -ChartTitle "Flare IO/Sec - SPB" -ChartType "png" -ChartFullPath $ChartFullPath $HTMLReportText += Write-ChartHTML $ChartFullPath |
The final portion of the script closes out the html file and writes it to disk.
1 2 3 4 5 6 |
# Close HTML Document $HTMLReportText += "</body></html>" # Write HTML Report to file $HTMLReportFullPath = $VNXeReportOutputLocation + "" + $HTMLReportName $HTMLReportText | Set-Content -Path $HTMLReportFullPath |
This should provide a good starting point to use for reporting. It has much room for improvement. Everyone please comment with information discovered about the SQLite data and information added to the report.
Start-VNXeHTMLPerformanceReport.zip
Regards,
Dave