By Bill Ramos, Program Manager, SQL Server Manageability Team
In part 3 of the report series, I showed how to get CPU data from the MDW and display it as a thumbnail chart in the Server Activity History report. In part 4, I’ll show how to extract data from the MDW for the Disk I/O Usage, Network Usage, and Memory Usage thumbnail charts rounding out the top of the report as sown below.
For the DBA new to Reporting Services, I’ll also show how to make sure that the color for System and SQL Server series is the same across the thumbnail charts – something that the shipping reports don’t do. I’ll also point out some other tricks like changing the thickness of the lines in the charts – seemed like it should be simple – but took me an hour to figure that one out.
The Disk I/O Usage chart gets its data from the Process performance counter object and has four conversion records in the core.performance_counter_report_group_items table that I described in part 3. The System series reports the _Total for the sum of the IO Read Bytes/sec and IO Write Bytes/sec performance counters. The SQL Server series reports the sum of the same two counters for the specific instances. You can use the following query to see what counters are used.
USE sysutility_mdw -- Use your MDW name here GO SELECT counter_subgroup_id, series_name, object_name, object_name_wildcards, counter_name, instance_name, multiply_by FROM core.performance_counter_report_group_items WHERE (counter_subgroup_id = N'IOUsage');
USE sysutility_mdw -- Use your MDW name here
GO
SELECT counter_subgroup_id, series_name, object_name, object_name_wildcards,
counter_name, instance_name, multiply_by
FROM core.performance_counter_report_group_items
WHERE (counter_subgroup_id = N'IOUsage');
When you run the query, you’ll notice that the multiply value is 0.0000009537. This value is used to convert bytes/sec to MB/sec ( = bytes / 1024 / 1024).
From a reporting standpoint, we can reuse the Perfmon Dataset used for the CPU chart by just changing the filter expression for the chart.
The easiest way to get going with the Disk I/O Usage chart is to copy the CPU chart and paste it back into the report. Before doing the copy/paste action, there are two little changes you’ll want to make.
Just select the CPU chart so that the entire outline of the chart is selected and issue the paste command. Then move to chart along side of the CPU chart. Follow these steps to modify the CPU chart to use the IOUsage data.
Chart Properties
Chart Data Values
Vertical Axis Properties
The chart needs to show MB/sec so the maximum range for values is no longer 100. To change this axis values, do the following:
Label Text Changes
At this point, you can now Run the report to check out your work.
The Network Usage chart is almost like Disk IO. It uses just one counter ( Bytes Total/sec) from the Network Interface counter object. to create the chart, do the following:
=Avg(Fields!avg_formatted_value.Value) / 1024 / 1024
The reason for using the expression is that the record for for networkUsage in the core.performance_counter_report_group_items table has a multiply factor of 1.0 (a compensated bug) . We originally tested on slow network cards and didn’t realize we needed to report on a scale of MB/sec. Rather than fix the table, the “unnamed” developer put the conversion of bytes to MB in the chart value expression. We have to live with this for now.
At this point, the Network Usage chart is ready to go.
As you can see, reporting against performance counters is really simply with the help of the Perfmon dataset that uses the snapshots.rpt_generic_perfmon stored procedure in the MDW. The magic having the corresponding records in the core.performance_counter_report_group_items table.
Data for the memory usage for the System and SQL Server is stored in the snapshots.sql_process_and_system_memory table. This data is collected every minute by the Server Activity collection set from the sys.dm_os_process_memory, sys.dm_os_sys_memory and sys,dm_sys_info DMVs using the following query:
SET NOCOUNT ON SELECT pm.physical_memory_in_use_kb AS sql_physical_memory_in_use_kb, pm.large_page_allocations_kb AS sql_large_page_allocations_kb, pm.locked_page_allocations_kb AS sql_locked_page_allocations_kb, pm.total_virtual_address_space_kb AS sql_total_virtual_address_space_kb, pm.virtual_address_space_reserved_kb AS sql_virtual_address_space_reserved_kb, pm.virtual_address_space_committed_kb AS sql_virtual_address_space_committed_kb, pm.virtual_address_space_available_kb AS sql_virtual_address_space_available_kb, pm.page_fault_count AS sql_page_fault_count, pm.memory_utilization_percentage AS sql_memory_utilization_percentage, pm.available_commit_limit_kb AS sql_available_commit_limit_kb, pm.process_physical_memory_low AS sql_process_physical_memory_low, pm.process_virtual_memory_low AS sql_process_virtual_memory_low, sm.total_physical_memory_kb AS system_total_physical_memory_kb, sm.available_physical_memory_kb AS system_available_physical_memory_kb, sm.total_page_file_kb AS system_total_page_file_kb, sm.available_page_file_kb AS system_available_page_file_kb, sm.system_cache_kb AS system_cache_kb, sm.kernel_paged_pool_kb AS system_kernel_paged_pool_kb, sm.kernel_nonpaged_pool_kb AS system_kernel_nonpaged_pool_kb, sm.system_high_memory_signal_state AS system_high_memory_signal_state, sm.system_low_memory_signal_state AS system_low_memory_signal_state, si.bpool_commit_target AS bpool_commit_target, si.bpool_committed AS bpool_committed, si.bpool_visible AS bpool_visible FROM sys.dm_os_process_memory AS pm CROSS JOIN sys.dm_os_sys_memory AS sm -- single-row DMV CROSS JOIN sys.dm_os_sys_info AS si; -- single-row DMV
SET NOCOUNT ON
SELECT
pm.physical_memory_in_use_kb AS sql_physical_memory_in_use_kb,
pm.large_page_allocations_kb AS sql_large_page_allocations_kb,
pm.locked_page_allocations_kb AS sql_locked_page_allocations_kb,
pm.total_virtual_address_space_kb AS sql_total_virtual_address_space_kb,
pm.virtual_address_space_reserved_kb AS sql_virtual_address_space_reserved_kb,
pm.virtual_address_space_committed_kb AS sql_virtual_address_space_committed_kb,
pm.virtual_address_space_available_kb AS sql_virtual_address_space_available_kb,
pm.page_fault_count AS sql_page_fault_count,
pm.memory_utilization_percentage AS sql_memory_utilization_percentage,
pm.available_commit_limit_kb AS sql_available_commit_limit_kb,
pm.process_physical_memory_low AS sql_process_physical_memory_low,
pm.process_virtual_memory_low AS sql_process_virtual_memory_low,
sm.total_physical_memory_kb AS system_total_physical_memory_kb,
sm.available_physical_memory_kb AS system_available_physical_memory_kb,
sm.total_page_file_kb AS system_total_page_file_kb,
sm.available_page_file_kb AS system_available_page_file_kb,
sm.system_cache_kb AS system_cache_kb,
sm.kernel_paged_pool_kb AS system_kernel_paged_pool_kb,
sm.kernel_nonpaged_pool_kb AS system_kernel_nonpaged_pool_kb,
sm.system_high_memory_signal_state AS system_high_memory_signal_state,
sm.system_low_memory_signal_state AS system_low_memory_signal_state,
si.bpool_commit_target AS bpool_commit_target,
si.bpool_committed AS bpool_committed,
si.bpool_visible AS bpool_visible
FROM sys.dm_os_process_memory AS pm
CROSS JOIN sys.dm_os_sys_memory AS sm -- single-row DMV
CROSS JOIN sys.dm_os_sys_info AS si; -- single-row DMV
To prepare this data for the reports, you can use the snapshots.rpt_sql_process_and_system_memory stored procedure to get the data just like you would for the performance counters.
This stored procedure only takes three parameters:
To create the dataset that calls the snapshots.rpt_sql_process_and_system_memory stored procedure, do the following:
You now have a dataset ready for the Memory Usage thumbnail chart. You’ll notice that there are 45 fields returned in the dataset – we will only need four fields.
This chart is a bit different from the other charts – there is no series group. Instead, it uses two values. Here is what you can do to create the chart:
At this point, you should only have the [interval_end_time] field in the Category Group section for Chart Data.
To add the two series value expressions, you need to click on the Plus icon on the caption line as shown below and select the Expression command.
Enter in the following expression for System Memory. This expression computes the memory used by the system as the total physical memory minus the available physical memory averaged over the interval period and divides the result by 1024 to convert the value to MB.
=Avg(Fields!system_total_physical_memory_kb.Value-Fields!avg_system_available_physical_memory_kb.Value) / 1024
To complete the series definition, do the following:
Next, we will add the SQL Server Memory used value. This comes directly from the result field named avg_sql_physical_memory_in_use_kb.Value.
=Avg(Fields!avg_sql_physical_memory_in_use_kb.Value) / 1024
Let’s clean up the chart title by replacing Network Usage to Memory Usage. Then change the vertical axis label from MB/sec to just MB.
That’s it for this post. I’ve attached the latest version of Server_Activity_Part4.rdl to as a reference.
In the next post, I’ll go over the SQL Server Waits stats chart, but with improvements to stabilize the colors and use an area chart instead of the stacked bars.
Please provide details for Wait Type report.
Hi Bill,
I tried emailing you and raising my queries on the blogs, please assists all reporting like standard reports, performance dashboard reports are accessible in the .rdl format but the MDW reports. We need to have an external hosting site for the company to pulish the reports. Please assist in identifying the report set for MDW.
YOur Help is highly appreciated.
Thanks
Vikas Dharia
This is a very useful series to someone new to SSRS. But Seems like What is need by the product is an ability to install/create the built-in reports to a reporting services database and the ability to augment the the built-in reports in SSMS. Do you know if there is a connect issue on this?
Following up on further availability of reports