Time for a Friday night post. Microsoft PFE raise the absence of system performance baselines pretty much in every Risk Assessment Program (RAP) or Health Check. Customers do not generally create performance baselines.
So, what are the typical uses for a performance baseline? Troubleshooting performance-related issues and facilitating capacity management comes to mind. “Hey, doesn’t Opsmgr have that information by default?” I hear you say. Opsmgr does indeed have some of it, but the performance information, for SQL Server at least, is not complete and only available for 7 days in the OperationsManager database and 10 days in the OperationsManagerDW database (with a default data retention configuration). We need to track performance baselines for systems over a much longer period.
Okay, so what is the plan (and make that step-by-step please)?
Get-PerformanceCounter | Export-Csv $env:HOMEDRIVE\All_Hosts_All_PerfCounters.csv -NoTypeInformation
Object Name
Counter Name
Memory
Pages Input/Sec
Free System Page Table Entries
Paging file
%Usage Peak
Process (sqlservr)
%Processor Time
Process (msmdsrv)
SQLServer:Access Methods
Forwarded Records/sec
Full Scans / sec
Index Searches/sec
Page Splits/sec
Workfiles Created/sec
Worktables From Cache Ratio
Table Lock Escalations/sec
SQLServer:Transactions
Longest Running Transaction Time
SQLServer:Memory Manager
Granted Workspace Memory (KB)
Maximum Workspace Memory (KB)
Memory Grants Outstanding
Memory Grants Pending
Total Server Memory (KB)
Target Server Memory (KB)
SQLServer:Databases
Data File(s) Size (KB)
Log Bytes Flushed/sec
Log File(s) Size (KB)
Log File(s) Used Size (KB)
Log Flush Wait Time
Log Flush Waits/sec
Log Flushes/sec
Log Growths
Log Shrinks
Log Truncations
Percent Log Used
SQLServer:Buffer Manager
Free List Stalls/sec
Lazy Writes/Sec
Checkpoint Pages/sec
Page Life Expectancy
Page Lookups/sec
Page Reads/sec
Page Writes/sec
Readahead/sec
Database Pages
Procedure Cache Pages
SQL Server:Buffer Manager
Target Pages
Free Pages
Stolen Pages/sec
SQL Server:SQL Statistics
Batch requests/sec
SQL Attention Rate/sec
SQL Server:Cursor Manager by Type
Active Cursors
SQL Server:SQL Errors
Errors/sec
SQL Server:Deprecated Features
Usage
SQL Server:General Statistics
Logouts/sec
SQL Server:Latches
Latch Waits/sec
Avg Latch Wait Time (ms)
Total Latch Wait Time (ms)
SQL Server:Locks
Lock Wait Time (ms)
Avg Wait Time (ms)
Get-MonitoringClass -Name "Microsoft.SQLServer.2008.DBEngine" | Get-MonitoringObject | % `
{$aaa=$_.Id;$bbb=$_.PathName;Get-PerformanceCounter | ? {$_.MonitoringObjectId -eq $aaa -and $_.ObjectName -eq "SQLSERVER:SQL Statistics" -and $_.CounterName -eq "SQL Re-Compilations/sec"} | Get-PerformanceCounterValue -StartTime ((get-date).adddays(-7)) -EndTime (get-date) | Select TimeSampled,SampleValue | Export-Csv -NoTypeInformation $env:HOMEDRIVE\$bbb.csv};
Import-Csv c:\JVTools\SQL.csv | % `
{$Counter=$_.Counter;$Object=$_.Object;Get-MonitoringClass -Name "Microsoft.SQLServer.2008.DBEngine" | Get-MonitoringObject | % `
{$aaa=$_.Id;$bbb=$_.PathName;$Object;$Counter;$count++;$CounterStr=$Counter-replace("/"," per ");$ObjectStr=$Object-replace(":","-");Get-PerformanceCounter | ? {$_.MonitoringObjectId -eq $aaa -and $_.ObjectName -eq $Object -and $_.CounterName -eq $Counter} | Get-PerformanceCounterValue -StartTime ((get-date).adddays(-7)) -EndTime (get-date) | Select TimeSampled,SampleValue | Export-Csv -NoTypeInformation $env:HOMEDRIVE\$Count$ObjectStr$CounterStr$bbb.csv}};
I know that this data can also be retrieved from the OperationsManagerDW database in SQL (the OperationsManager database is not a good idea from an Opsmgr performance perspective...as the SQL guy, you may have the pesky Opsmgr Admin on your case with his own pesky Opsmgr performance baseline indicating that system stats degraded since you started fiddling) and I also know that a custom Opsmgr report to replace the WinWord template is very possible. That is a post for another time, this time the focus was on using PowerShell. I am also aware that this view is largely server-centric and that a more holistic end-to-end service performance baseline would be a useful thing...hmm Opsmgr does include features for creating Distributed Applications...wonder if I can target that with the MonitoringObject?
Have fun!
Johan