Wednesday, April 18, 2012

[OpsMgr 2007] How to create a group of objects that are contained by an other group

First I would like to thanks  for his post http://blogs.technet.com/b/kevinholman/archive/2010/09/09/how-to-create-a-group-of-objects-that-are-contained-by-some-other-group.aspx

I've work on the MP he has provided is his post and added 3 groups to answer this interesting customer request.

The request was to be able to make an override on the monitor "Percentage of Committed Memory in Use" in the OS MP for all SQL servers. Not so easy to do it since you retrieve at least 3 monitors "Percentage of Committed Memory in Use" - one in each Windows Server xxxx Operating System class. We have also to build 3 groups, one per OS version.

And to be really clean, I have to create 3 dynamic groups that contains Operating System.objects - one by OS version. Dynamic groups because customer asked the override to be created for all SQL servers monitored.
  1. One group of Operating System = 2008 and server is SQL server
  2. One group of Operating System = 2003 and server is SQL server
  3. One group of Operating System = 2000 and server is SQL server
As explained by Kevin, this is not doable within the SCOM console, you have to edit group in the authoring console.

The way to proceed will be the same as the one explained by Kevin. I've also add some other references to the Microsoft Windows Server xxxx MPs :



Then you are able to create 3 classes OS2000GroupSQL, OS2003GroupSQL and OS2008GroupSQL and the 3 associated discoveries:
  1. Populate OS Group – SQL – 2008 Server
  2. Populate OS Group – SQL – 2003 Server
  3. Populate OS Group – SQL – 2000 Server
For each discovery, choose a target class, which will be the Group class we just created earlier. Select the “Discovered Classes” tab and add Microsoft.SystemCenter.InstanceGroupContainsEntities in the “Discovered relationships and their attributes”.
Then select the Configuration tab, Browse for a Type and select Microsoft.SystemCenter.GroupPopulator. Give a module ID - then you may have an error that must be ignored.
On the configuration screen – select “Edit”
We will be replacing the XML showing in Notepad with an example I have written.  Highlight all but the first line and delete it.

Then paste this for the 2008 discovery :

<RuleId>$MPElement$</RuleId>
  <GroupInstanceId>$MPElement[Name="Custom.Group.Example.OS2008GroupSQL"]$</GroupInstanceId>
  <MembershipRules>
    <MembershipRule>
      <MonitoringClass>$MPElement[Name="Server2008!Microsoft.Windows.Server.2008.OperatingSystem"]$</MonitoringClass>
      <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass>
      <Expression>
        <And>
          <Expression>
            <RegExExpression>
              <ValueExpression>
                <Property>$MPElement[Name="Windows!Microsoft.Windows.OperatingSystem"]/OSVersionDisplayName$</Property>
              </ValueExpression>
              <Operator>ContainsSubstring</Operator>
              <Pattern>2008</Pattern>
            </RegExExpression>
          </Expression>
          <Expression>
            <Contained>
              <MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</MonitoringClass>
              <Expression>
                <Contained>
                  <MonitoringClass>$MPElement[Name="MicrosoftSQLServerLibrary!Microsoft.SQLServer.ComputerGroup"]$</MonitoringClass>
                </Contained>
              </Expression>
            </Contained>
          </Expression>
        </And>
      </Expression>
    </MembershipRule>
  </MembershipRules>
</Configuration>


Save the discovery, save your MP and import it in your DEV environment ! :)

You will be able to retrieve your new group in the authoring part :
Note I've keep the group created by Kevin.



Just right click on it and select “View Group Members” - the group OS Group - SQL - 2008 Server should be populated with OS 2008 objects corresponding to SQL server installed in Windows server 2008 or 2008 R2 and all other version.





You can download my MP for testing purpose here in this folder

This posting is provided "AS IS" with no warranties.

No comments:

Post a Comment