Labels

Friday, July 18, 2008

Passing Parameters between OpsMgr and SSRS

This post provides information on passing parameters between Operations Manager 2007 and SQL Server Reporting Services (SSRS) when creating customised reports. It discusses Operations Manager Smart Controls, using dataset queries and populating parameters from a string.

This is the third in a series of posts on creating customised Operations Manager reports; see the posts 'OpsMgr 2007 Customized Reporting - SQL Queries' and 'OpsMgr 2007 SSRS Reports using SQL 2005 XML'.

Report parameters define input parameters to the report, which are then typically passed to dataset parameters, used to determine the data displayed in the report. The dataset parameters can be used in-line with text-based SQL queries, or passed to a SQL Stored Procedure.

Report Smart Controls

Operations Manager provides several controls tailored to OpsMgr specific reporting. For example:

  • Microsoft.SystemCenter.DataWarehouse.Report.ParameterControl.MonitoringObjectXmlPicker
  • Microsoft.SystemCenter.DataWarehouse.Report.ParameterControl.PerformanceRulePicker
  • Microsoft.SystemCenter.DataWarehouse.Report.ParameterControl.TextBox

The controls are documented in the reporting guide and can be seen in use by unsealing the standard Microsoft Management Packs. Generally the controls relate to data stored in Operations Manager, such as the Monitoring Object or Performance Rule pickers, providing methods of selecting and passing existing OpsMgr data types as parameters.

The example below shows the definition of the control for a multi-value textbox, using the multiline property element to enable multiline support for the control. The idea of this control is to provide a text-string filter that would be passed as a parameter to SSRS to filter or determine the final output of a report.


<Control type="Microsoft.SystemCenter.DataWarehouse.Report.ParameterControl.TextBox" rowSpan="3" columnSpan="1">
  <ReportParameters>
    <ReportParameter name="InstanceFilter">
      <Prompt>Custom!Microsoft.SystemCenter.DataWarehouse.Report.ParameterPrompt.InstanceFilter</Prompt>
    </ReportParameter>
  </ReportParameters>
  <Properties>
    <Property name="Multiline">
      <Value>True</Value>
    </Property>
  </Properties>
</Control>


Populating parameters from a string

Single and multi-valued strings can be used to provide default parameters to the report. Unfortunately, the multi-line support of this control does not map to a multi-value string input expected by SSRS, and only the first instance works. The correct method would be to use another control to select instances based on the object/rule and then pass this to the SQL query for filtering.

Populating parameters from a dataset query

Populating parameters from a dataset query is a flexible method of providing parameter defaults that can be designed to minimise changes in the future. For example, the default group target for a report can remain constant, with only the members of that group changing as reporting needs change. Rather than hard-coding a partulcar GUID, a lookup based on a well-known name can also save re-work.

For example, the following direct text SQL query returns the Rule GUID for the 'Logical Disk Free Megabytes' rule, which could be used to populate a default report parameter, providing a default when the report is opened:

SELECT vRule.RuleGuid from vRule
inner join vPerformanceRule ON vPerformanceRule.RuleRowID = vRule.RuleRowID
WHERE vRule.RuleDefaultName = 'Logical Disk Free Megabytes'

Another example is constructing XML to find the ManadedEntityRowID of a particular group, again useful for populating report parameter defaults:

SELECT '<Data><Objects><Object Use=''Containment''>' + Cast(ManagedEntityRowID as varchar) + '</Object></Objects></Data>' as XMLManagedEntity
FROM vManagedEntity WHERE ManagedEntityDefaultName = 'Custom Group Name'


Note the use of the double single-quotes, required to allow this text to be stored in an XML management pack definition while still resulting in well-formed XML.

References

OpsMgr 2007 Customized Reporting - SQL Queries
http://waynes-world-it.blogspot.com/2008/07/opsmgr-2007-customized-reporting-sql.html

OpsMgr 2007 SSRS Reports using SQL 2005 XML
http://waynes-world-it.blogspot.com/2008/05/opsmgr-2007-ssrs-reports-using-sql-2005.html



Wayne's World of IT (WWoIT), Copyright 2008 Wayne Martin.

No comments:


All Posts

printQueue AD objects for 2003 ClusterVirtualCenter Physical to VirtualVirtual 2003 MSCS Cluster in ESX VI3
Finding duplicate DNS recordsCommand-line automation – Echo and macrosCommand-line automation – set
Command-line automation - errorlevels and ifCommand-line automation - find and findstrBuilding blocks of command-line automation - FOR
Useful PowerShell command-line operationsMSCS 2003 Cluster Virtual Server ComponentsServer-side process for simple file access
OpsMgr 2007 performance script - VMware datastores...Enumerating URLs in Internet ExplorerNTLM Trusts between 2003 and NT4
2003 Servers with Hibernation enabledReading Shortcuts with PowerShell and VBSModifying DLL Resources
Automatically mapping printersSimple string encryption with PowerShellUseful NTFS and security command-line operations
Useful Windows Printer command-line operationsUseful Windows MSCS Cluster command-line operation...Useful VMware ESX and VC command-line operations
Useful general command-line operationsUseful DNS, DHCP and WINS command-line operationsUseful Active Directory command-line operations
Useful command-linesCreating secedit templates with PowerShellFixing Permissions with NTFS intra-volume moves
Converting filetime with vbs and PowerShellDifference between bat and cmdReplica Domain for Authentication
Troubleshooting Windows PrintingRenaming a user account in ADOpsMgr 2007 Reports - Sorting, Filtering, Charting...
WMIC XSL CSV output formattingEnumerating File Server ResourcesWMIC Custom Alias and Format
AD site discoveryPassing Parameters between OpsMgr and SSRSAnalyzing Windows Kernel Dumps
Process list with command-line argumentsOpsMgr 2007 Customized Reporting - SQL QueriesPreventing accidental NTFS data moves
FSRM and NTFS Quotas in 2003 R2PowerShell Deleting NTFS Alternate Data StreamsNTFS links - reparse, symbolic, hard, junction
IE Warnings when files are executedPowerShell Low-level keyboard hookCross-forest authentication and GP processing
Deleting Invalid SMS 2003 Distribution PointsCross-forest authentication and site synchronizati...Determining AD attribute replication
AD Security vs Distribution GroupsTroubleshooting cross-forest trust secure channels...RIS cross-domain access
Large SMS Web Reports return Error 500Troubleshooting SMS 2003 MP and SLPRemotely determine physical memory
VMware SDK with PowershellSpinning Excel Pie ChartPoke-Info PowerShell script
Reading web content with PowerShellAutomated Cluster File Security and PurgingManaging printers at the command-line
File System Filters and minifiltersOpsMgr 2007 SSRS Reports using SQL 2005 XMLAccess Based Enumeration in 2003 and MSCS
Find VM snapshots in ESX/VCComparing MSCS/VMware/DFS File & PrintModifying Exchange mailbox permissions
Nested 'for /f' catch-allPowerShell FindFirstFileW bypassing MAX_PATHRunning PowerSell Scripts from ASP.Net
Binary <-> Hex String files with PowershellOpsMgr 2007 Current Performance InstancesImpersonating a user without passwords
Running a process in the secure winlogon desktopShadow an XP Terminal Services sessionFind where a user is logged on from
Active Directory _msdcs DNS zonesUnlocking XP/2003 without passwords2003 Cluster-enabled scheduled tasks
Purging aged files from the filesystemFinding customised ADM templates in ADDomain local security groups for cross-forest secu...
Account Management eventlog auditingVMware cluster/Virtual Center StatisticsRunning scheduled tasks as a non-administrator
Audit Windows 2003 print server usageActive Directory DiagnosticsViewing NTFS information with nfi and diskedit
Performance Tuning for 2003 File ServersChecking ESX/VC VMs for snapshotsShowing non-persistent devices in device manager
Implementing an MSCS 2003 server clusterFinding users on a subnetWMI filter for subnet filtered Group Policy
Testing DNS records for scavengingRefreshing Computer Account AD Group MembershipTesting Network Ports from Windows
Using Recovery Console with RISPAE Boot.ini Switch for DEP or 4GB+ memoryUsing 32-bit COM objects on x64 platforms
Active Directory Organizational Unit (OU) DesignTroubleshooting computer accounts in an Active Dir...260+ character MAX_PATH limitations in filenames
Create or modify a security template for NTFS perm...Find where a user is connecting from through WMISDDL syntax in secedit security templates

About Me

I’ve worked in IT for over 13 years, and I know just about enough to realise that I don’t know very much.