SCOM 2012 R2 – MP Authoring and Math Functions

Based on the discovery outlined in the last post regarding the changes to the ExpressionFilter, I decided to take a closer look at what has been added from a net new perspective with the intent of circling back and see what additional changes have been made to the existing/legacy modules.  Just to start, I decided to focus on the System.Library.mp.  Keep in mind, I am comparing the SCOM 2007 R2 management pack to the one that is in my 2012 R2 environment.  As such, it is entirely possible that this material applies to anything 2012 or newer.

$Path = “c:\tmp\”

Import-Module OperationsManager
New-SCOMManagementGroupConnection TSTSCOM1

$mp1 = get-scommanagementpack -managementpackfile “C:\Program Files (x86)\System Center 2012 Visual Studio Authoring Extensions\References\OM2007R2\System.Library.mp”
$mp2 = get-scommanagementpack | ?{$_.name -eq ‘System.Library’}  #the environment is R2

$MP1Mods = $Mp1.GetModuleTypes()
$MP1Names = $MP1Mods | foreach{$_.Name}
$MP2Mods = $Mp2.GetModuleTypes()
$MP2Names = $MP2Mods | foreach{$_.Name}

Compare-Object $MP1Names $MP2Names | out-file ($Path + “Results1.txt”) -encoding ascii

Results in:

InputObject                                                 SideIndicator
———–                                                     ————-
System.Computation                                         =>
System.UniquenessScheduler                              =>
System.ExpressionFilter.IntervalSuppression       =>
System.ICMPProbe                                             =>
System.ExpressionFilter.EventSuppression          =>

The first one, System.Computation catches my eye.  Not just because it’s the first one, but because it seems like it could come in handy just based on the name.  The other ones seem like they may be useful as well, but we’ll look at those later.  I do a quick Bing search on System.Computation and it yields the generic MSDN page.  There is a little bit of data there, but nothing that really shows how to use the module.

At this point, I do a dump of all of the MPs in my SCOM 2012 R2 environment to ‘c:\mpexport’ and then do a quick search to see which of these exports have System.Computation.  The results are System.Library.xml (expected) and System.NetworkManagement.Monitoring.xml.  I pop both of them open to see how this module has been used and find that the NetworkManagement management pack has exactly what I am looking for:

image

According to this, the System.Computation condition detection module starts and ends with <NumericValue> tags.  Now, I try to find a monitor that uses this particular monitor type.  I find one that passes in the “PercentageExpression”:

image

Not bad, from this it would seem the values simply need to be wrapped in <NumericValue> tags, and they can be manipulated using <Product>, <Division>, and <Summation>.  I make the leap and assume <Subtraction> works as well (verified).  Pretty sweet!  Going into Visual Studio VSAE, I try Intellisense to see if I can get any additional results.  Nothing.  However, upon trying a derivation of Modulo, I did get the following error:

image

It would seem the full list of accepted values is documented there.  I do a few more Bing searches and I end up on the System.NetworkManagement.Computation page.  It has all of the values as well as how to use them documented since System.Computation is a sub module of the NetworkManagement computation module.

image

This is documented with the System.NetworkManagement.Computation Condition Detection article here.  The article also contains samples that pertain to how to use the base System.Computation module as well.

Great stuff.  From time to time, I have been forced to drop into a script to do some sort of simplistic mathematical manipulation of the data.  No longer!

*Note that this is provided “AS-IS” with no warranties at all. This is not a production ready solution, just an idea and an example.

Management Packs, MP Authoring, SC Operations Manager

Leave a Reply