SCOM Tipp: Adding a Relative Date Time Picker to a SCOM report

I would like to whish you all a happy new year as this is my first post in 2014!

One of the topics a SCOM administrator has to deal with is reporting. You probably already have created one or more custom reports. Most of the documentation about this is still from SCOM 2007 R2 – which also works for 2012 – and references to basic date/time fields, where you can enter fixed dates.

Standard date/time picker:
standard picker

Here are some authoring examples:
http://technet.microsoft.com/en-us/library/hh528528.aspx
http://blogs.technet.com/b/jonathanalmquist/archive/2011/01/03/custom-report-authoring-for-beginners.aspx
http://thoughtsonopsmgr.blogspot.de/2011/08/my-first-little-report-part-i-lets-make.html

If you have to run a report on a monthly basis you perhaps also want to be able to schedule the report and use relative dates, but that is not possible with standard startdate and enddate parameters.

Relative date/time picker:
relative picker

You need to follow this Technet blog to add a relative date time picker: http://technet.microsoft.com/en-us/library/gg697751.aspx. Specially check the section “Example: Adding a Relative Date Time Picker to the Alert Report“.
The article describes well what needs to be done to change a standard report into a report with relative date time.

Some things I was struggeling with:

  • General: You can add all necessary parts through direct XML editing, you only need to know where to add them. => see Sample.Reports.Relative.xml which will help you with that.
  • Replace StartDate/Enddate with relative Parameters:
    Replace the @Startdate and @Enddate values in the queries with CONVERT(DATETIME, CONVERT(VARCHAR, @StartDate, 101)) and CONVERT(DATETIME, CONVERT(VARCHAR, @EndDate, 101)).
    After replacing your startdate and enddate with the new relative parameters, search for your old parameter name and check that you have not used it somewhere, where it was not mentioned in the article!
  • Controls in the Parameter block: The article only describes the parameters, which are needed for the relative date time picker, but you also will need controls if you have additional fields, otherwise you only see the date time fields.  Here is the list of common report controls.
    The Parameter Block is always direct before the report in the XML => see Sample.Reports.Relative.xml

I have also created two sample management packs with one sample report in it which will show the differences.

You can download the sample report management packs here.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: