SCOM: Advanced Group Population Formula Development (GroupCalc) for the XML Impaired

einsteinfunny

May 27th, 2010 – I wanted to tell you about a scenario I encountered recently and the thought process I went through as I attempted to build a group formula in XML in System Center Operations Manager 2007. If you’re like me, XML is not your first language. Actually, if you’re like me, XML is my second language either. However, I do believe this can be overcome…it takes some practice and repetition and winning small battles over time. I’ll share with you a thought process that incorporates natural language evaluation of the required formula along with a couple of great resources I found I believe will help you make more sense of the process. XML in plain English….so to speak.

I will warn you that you must either understand the relationships between existing classes are working with or have the MP viewer and the management packs handy to look them up… anybody can do that easily.

The Challenge

This was our challenge. We had Windows servers belonging to different departments, and each group wanted to handle their tuning separately. Additionally, they wanted a number of common objects on these servers, such as SQL databases, web sites and logical disks hosted on these servers, dynamically grouped (per department) as part of a fully automated process.

Segmenting the Servers

Step one was to find which servers belong to which departments. This is easily handled by incorporating a custom registry key(s) and/or value into the server build process. This gave us a basis for a custom class that we could then use to group servers by department (unique key / class for each dept)

Step two is more challenging…. dynamically grouping SQL databases or IIS websites by department. Since we’re not grouping computers, going to create an instance group in the authoring console using an XML group population formula created in notepad. This is challenging because or custom class is outside the chain of containment (hosting) relationships inherently present the Microsoft management packs. We considered custom classes derived from computer rules and from the objects themselves, but nothing resulted in a simple group population formulas for the objects we needed to group that could be easily assembled in the Operations console. That being said, we used Windows Computer Role as a base (Local Application would work equally well).

Pondering the Possibilities with GroupCalc

While he didn’t have an example that fit my scenario, Mike Eisenstein had an explanation for advanced formula construction with the GroupCalc provider that really struck a chord with me (available HERE). I think it was Albert Einstein who said “if you can’t explain it simply, then you don’t understand the problem”. Mike clearly understands the challenge very well and proves this in several well explained examples. Truly a brilliant guy.  The most important thing he said in the article from my perspective is this:

“The GroupCalc provider is actually a database query, so it’s not a coincidence that the syntax can be mapped to SQL.”

What this tells us if we can state in pseudo code what we require, we can easily adapt some XML from existing sources to build what at first glance seem to be very complicated formulas. Let’s apply that to the scenario described above.

Describing the Formula for GroupCalc in Plain English (or language of your choice)

In the end, we needed to build groups that dynamically grouped objects based on a formula that in plain English, reads something like this in pseudo (and pictured below):

  • populate my group with SQL 2008 databases
  • equal to the databases that are contained by SQL instances
  • which are hosted by Windows Computers
  • which contain my custom class

I’ve basically described here the chain of containment that leads me from my custom class to the databases I need to add to the group…

image

Now let’s write the formula for each step of the pseudo code above.

Writing the GroupCalc Formula

NOTE: If you want a downloadable copy of this formula, see the attachment on our original forum discussion HERE.

1. populate my group with SQL 2008 databases  (the MembershipRule)

 

2. equal to the databases that are contained by SQL instances (represented by the SQL DB Engine class)

3. which are contained (hosted) by Windows Computers

4. which contains my custom class (which is my class based on registry keys to ID the dept that owns the server)

5. and here’s the remaining XML… and just the closing tags for the expressions we started above

Again, to download the xml code snippet, log into systemcentercentral.com and grab the txt file attached in my last comment on this thread – http://www.systemcentercentral.com/tabid/60/indexId/67720/tag/Forums+MP_Development/Default.aspx#vindex67776

And your next step is to add this into an instance group. Microsoft guru Jonathan Almquist has this covered very nicely, so I’ll not duplicate his work here.

How to Create an Instance Group in the Authoring Console

Here’s the step-by-step from Jonathan Almquist on how to make this happen in the Authoring console.

The XML you need for your instance group is attached to this post (login to download). A step-by-step for creating an instance group is available at http://blogs.technet.com/b/jonathanalmquist/archive/2010/05/08/how-to-create-an-instance-group-in-the-r2-authoring-console.aspx

Feedback and Questions

I’d love to hear not only your feedback, but your grouping challenges…I’d like to further Explorer the demystification of GroupCalc and XML with you. Post your object grouping challenges, whatever they may be, to the MP Development forums at SystemCenterCentral.com and we’ll explore the possibilities.

Follow System Center Central

RSS | TWITTER

Sponsors and Supporters

Quest | Veaam | System Center Influencers

Become an IRON CHEF in the System Center community. Enter the MANAGEMENT PACK EXTENSION CONTEST for a chance to win fame and fortune!

 

0 thoughts on “SCOM: Advanced Group Population Formula Development (GroupCalc) for the XML Impaired

  1. Avatar of Pete ZergerPete Zerger Post author

    Good question. The answer in this case is no, but in a high scale production scenario, is definitely the key as Raphael points out. I’d think carefully about the depth of search on every group leveraging GroupCalc formulas in this way. Worth another blog article I suppose.

  2. Avatar of KeithKKeithK

    Thanks for the article. I am trying to add cluster objects for associated windows computer objects via dynamic membership and am having a problem with my XML code. I have been successful in adding health service watcher objects with the similar model, however with my version of the windows cluster objects, it fails on the import. My code is listed at the bottom of the following article…

    http://social.technet.microsoft.com/Forums/en-US/operationsmanagerauthoring/thread/6cdce168-9823-4cce-be77-4bda24dba86d

    Can you offer any feedback regarding my logic/syntax here?

    As a point of reference I followed Tim McFadden’s logic posted here: http://www.scom2k7.com/dynamic-computer-groups-that-send-heartbeat-alerts/

  3. Avatar of ahoogahoog

    Hi Pete,

    I have what seemed to be a simple problem but turned out to be a nightmare for me…
    Here goes:

    I have a group of people monitoring everything, except a group of servers (FTV) which are outsourced.
    What I need to do is to make a view, similar to the default "Active Alerts" view, which contains all alerts except those from that particular group of servers.

    I made one group for FTV which is populated using an attribute targeted at the windows computer object.
    Then one group (Prod) with all windows computer objects except FTV.
    And then an alert view showing all, target Prod.

    And it works, sort of…. I don’t get all the alerts I want (from some SQL DBs for instance) and I get some I don’t want.

    Any help with this is greatly appreciated, I’ve been banging my head against this for days now :)

    Best regards,
    Anders

  4. Avatar of Steve IAnsonSteve IAnson

    Hi,

    Is it possible to modify the above to work with extended Windows Computer classes with a specific value set on a custom property?

    E.g. If Windows.Computer.Extended contains an attribute "Site", is it possible to say: where windows computer contains instances of Windows.Computer.Extended with property Site set to 1?

    Thanks

    Steve

Leave a Reply