Menu Close

What is a group anyway?

The most common reason we create groups in OpsMgr… is to scope Notifications, Views, and to use for overrides.

Most of the groups my customers create are dealing with Windows Computer objects.  The reason for this, is that the Windows Computer object class, is a “parent” level” class that works well for the group uses just mentioned.  Lets look at what a group really is… in XML:

When we create a simple group to contain Windows Computers in the UI, it creates some basic XML behind the scenes.  Understanding this XML – will help us create much more powerful and dynamic groups down the road… doing things that cannot be done in the UI.

Let’s get started.

I will create a new empty MP, named “GroupMP”.

With nothing in this MP… let’s look at the XML:

 

<?xml version=”1.0? encoding=”utf-8??><ManagementPack ContentReadable=”true” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”> <Manifest> <Identity> <ID>GroupMP</ID> <Version>1.0.0.0</Version> </Identity> <Name>GroupMP</Name> <References> <Reference Alias=”SystemCenter”> <ID>Microsoft.SystemCenter.Library</ID> <Version>6.0.6278.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> </References> </Manifest> <Presentation> <Folders> <Folder ID=”Folder_ba0b8fceb992416c835fe9d66a6ce0a1? Accessibility=”Public” ParentFolder=”SystemCenter!Microsoft.SystemCenter.Monitoring.ViewFolder.Root” /> </Folders> </Presentation> <LanguagePacks> <LanguagePack ID=”ENU” IsDefault=”false”> <DisplayStrings> <DisplayString ElementID=”GroupMP”> <Name>GroupMP</Name> <Description /> </DisplayString> <DisplayString ElementID=”Folder_ba0b8fceb992416c835fe9d66a6ce0a1?> <Name>GroupMP</Name> </DisplayString> </DisplayStrings> </LanguagePack> </LanguagePacks> </ManagementPack>

 

Not much there.  We have the <Manifest> section, which contains the name, version, ID, and a single reference – to the System Center Library MP.  The <Presentation> section simply contains the UI generated folder name, which will show up in the console, by default.  The <LanguagePacks> section contains the friendly names for the MP name and the folder… which will be displayed in the console.

Now – lets add a group.  I will create a new group in the UI, named “ATestGroup”.  I will not give it any group membership…. and save it to my new MP, and export it.  Let’s see what changed:

 

<?xml version="1.0" encoding="utf-8"?><ManagementPack ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <Manifest> <Identity> <ID>GroupMP</ID> <Version>1.0.0.0</Version> </Identity> <Name>GroupMP</Name> <References> <Reference Alias="SystemCenter"> <ID>Microsoft.SystemCenter.Library</ID> <Version>6.0.6278.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="MicrosoftSystemCenterInstanceGroupLibrary6062780"> <ID>Microsoft.SystemCenter.InstanceGroup.Library</ID> <Version>6.0.6278.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> </References> </Manifest> <TypeDefinitions> <EntityTypes> <ClassTypes> <ClassType ID="UINameSpace66d4622586f2416c804144a081d72995.Group" Accessibility="Public" Abstract="false" Base="MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroup" Hosted="false" Singleton="true" /> </ClassTypes> </EntityTypes> </TypeDefinitions> <Monitoring> <Discoveries> <Discovery ID="UINameSpace66d4622586f2416c804144a081d72995.Group.DiscoveryRule" Enabled="true" Target="UINameSpace66d4622586f2416c804144a081d72995.Group" ConfirmDelivery="false" Remotable="true" Priority="Normal"> <Category>Discovery</Category> <DiscoveryTypes> <DiscoveryRelationship TypeID="MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities" /> </DiscoveryTypes> <DataSource ID="GroupPopulationDataSource" TypeID="SystemCenter!Microsoft.SystemCenter.GroupPopulator"> <RuleId>$MPElement$</RuleId> <GroupInstanceId>$MPElement[Name="UINameSpace66d4622586f2416c804144a081d72995.Group"]$</GroupInstanceId> <MembershipRules> <MembershipRule Comment="EMPTY_RULE_8eadaced-59c8-4ebc-a4e4-b8428a374442"> <MonitoringClass>$MPElement[Name="SystemCenter!Microsoft.SystemCenter.AllComputersGroup"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <SimpleExpression> <ValueExpression> <Value>True</Value> </ValueExpression> <Operator>Equal</Operator> <ValueExpression> <Value>False</Value> </ValueExpression> </SimpleExpression> </Expression> </MembershipRule> </MembershipRules> </DataSource> </Discovery> </Discoveries> </Monitoring> <Presentation> <Folders> <Folder ID="Folder_ba0b8fceb992416c835fe9d66a6ce0a1" Accessibility="Public" ParentFolder="SystemCenter!Microsoft.SystemCenter.Monitoring.ViewFolder.Root" /> </Folders> </Presentation> <LanguagePacks> <LanguagePack ID="ENU" IsDefault="false"> <DisplayStrings> <DisplayString ElementID="GroupMP"> <Name>GroupMP</Name> </DisplayString> <DisplayString ElementID="Folder_ba0b8fceb992416c835fe9d66a6ce0a1"> <Name>GroupMP</Name> </DisplayString> <DisplayString ElementID="UINameSpace66d4622586f2416c804144a081d72995.Group"> <Name>ATestGroup</Name> </DisplayString> <DisplayString ElementID="UINameSpace66d4622586f2416c804144a081d72995.Group.DiscoveryRule"> <Name>Populate ATestGroup</Name> <Description>This discovery rule populates the group 'ATestGroup'</Description> </DisplayString> </DisplayStrings> </LanguagePack> </LanguagePacks> </ManagementPack>

 

 

In the <Manifest> section, we added a new reference… to the Microsoft.SystemCenter.InstanceGroup.Library MP, and gave it an alias of “MicrosoftSystemCenterInstanceGroupLibrary6062780”.  An alias is just a short way of referring to a management pack…  (just not so short when created by the UI) 

We also added a new section, <TypeDefinitions>  In here – we defined a new class type…  for the UI generated group.  In this case – it is UINameSpace66d4622586f2416c804144a081d72995.Group.  The UI creates a randomly generated name for the group… just to make sure all group ID’s are unique in a management pack.  This definition of this group class, is based on the “Microsoft.SystemCenter.InstanceGroup” class, which is called from the recently referenced “Microsoft.SystemCenter.InstanceGroup.Library” MP, using the alias we just talked about.  Notice – “Singleton = True”.  Without going too deep at this point, this means the Group is a class, but is a single instance class… the only instance of this group class will be the group itself.  It may have members in the group at some point…. but those members are NOT instances of the group class.  They are simply objects, that have a containment relationship from the group class.  Ok, not too deep right now.

We also added another new section to the XML – <Monitoring>  Under <Monitoring> we will define the discovery that we need to run – in order to populate the group membership.  This discovery by default will call the “Microsoft.SystemCenter.GroupPopulator” (Group populator module) from the “SystemCenter!” alias (Microsoft.SystemCenter.Library MP)  This discovery will define what types of objects the group will contain, and any <MembershipRule> expressions we need to use to “match” on those objects.  For instance… we might want to match only on Windows Computer objects, with a NetBIOS Name that starts with “EX*” using a wildcard.  All this can be done with the UI – but at this point – we left it all blank.  What you see is is a basic discovery that does nothing… in this case.

We will also notice – that the <DisplayStrings> section got updated with a friendly name for the new discovery rule… which will be visible in the console for the object discovery.

Ok….  now lets add a simple discovery rule… a dynamic rule, that will place Windows Computer objects that match the example I just used… NetBIOS names that start with “EX”

image

If I perform a “View Group Members” (after a short wait for the updated MP to be processed by the RMS, and the group populator module to complete)… I will see this when I “view group members”:

image

So far, so good.  I have 4 Windows Computer objects in my group, all matching my criteria.  Lets look at the XML now:

 

<?xml version="1.0" encoding="utf-8"?><ManagementPack ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <Manifest> <Identity> <ID>GroupMP</ID> <Version>1.0.0.0</Version> </Identity> <Name>GroupMP</Name> <References> <Reference Alias="MicrosoftSystemCenterInstanceGroupLibrary6062780"> <ID>Microsoft.SystemCenter.InstanceGroup.Library</ID> <Version>6.0.6278.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="SystemCenter"> <ID>Microsoft.SystemCenter.Library</ID> <Version>6.0.6278.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="MicrosoftWindowsLibrary6062780"> <ID>Microsoft.Windows.Library</ID> <Version>6.0.6278.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> </References> </Manifest> <TypeDefinitions> <EntityTypes> <ClassTypes> <ClassType ID="UINameSpace66d4622586f2416c804144a081d72995.Group" Accessibility="Public" Abstract="false" Base="MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroup" Hosted="false" Singleton="true" /> </ClassTypes> </EntityTypes> </TypeDefinitions> <Monitoring> <Discoveries> <Discovery ID="UINameSpace66d4622586f2416c804144a081d72995.Group.DiscoveryRule" Enabled="true" Target="UINameSpace66d4622586f2416c804144a081d72995.Group" ConfirmDelivery="false" Remotable="true" Priority="Normal"> <Category>Discovery</Category> <DiscoveryTypes> <DiscoveryRelationship TypeID="MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities" /> </DiscoveryTypes> <DataSource ID="GroupPopulationDataSource" TypeID="SystemCenter!Microsoft.SystemCenter.GroupPopulator"> <RuleId>$MPElement$</RuleId> <GroupInstanceId>$MPElement[Name="UINameSpace66d4622586f2416c804144a081d72995.Group"]$</GroupInstanceId> <MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="MicrosoftWindowsLibrary6062780!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <RegExExpression> <ValueExpression> <Property>$MPElement[Name="MicrosoftWindowsLibrary6062780!Microsoft.Windows.Computer"]/NetbiosComputerName$</Property> </ValueExpression> <Operator>MatchesWildcard</Operator> <Pattern>EX*</Pattern> </RegExExpression> </Expression> </MembershipRule> </MembershipRules> </DataSource> </Discovery> </Discoveries> </Monitoring> <Presentation> <Folders> <Folder ID="Folder_ba0b8fceb992416c835fe9d66a6ce0a1" Accessibility="Public" ParentFolder="SystemCenter!Microsoft.SystemCenter.Monitoring.ViewFolder.Root" /> </Folders> </Presentation> <LanguagePacks> <LanguagePack ID="ENU" IsDefault="false"> <DisplayStrings> <DisplayString ElementID="GroupMP"> <Name>GroupMP</Name> </DisplayString> <DisplayString ElementID="Folder_ba0b8fceb992416c835fe9d66a6ce0a1"> <Name>GroupMP</Name> </DisplayString> <DisplayString ElementID="UINameSpace66d4622586f2416c804144a081d72995.Group"> <Name>ATestGroup</Name> </DisplayString> <DisplayString ElementID="UINameSpace66d4622586f2416c804144a081d72995.Group.DiscoveryRule"> <Name>Populate ATestGroup</Name> <Description>This discovery rule populates the group 'ATestGroup'</Description> </DisplayString> </DisplayStrings> </LanguagePack> </LanguagePacks> </ManagementPack>

 

This basically just added a new reference, and modified the discovery rule section – to reflect our updated relationship and criteria.

The new <reference> was because we added the “Windows Computer” object class to the group definitions.  This class needs to be referenced, because it lives in the “Microsoft.Windows.Library” MP, which the UI gave a reference alias of “MicrosoftWindowsLibrary6062780”.

The UPDATED <MembershipRule> section now has some new information.  

First – it defines the <MonitoringClass> we will use in this membership rule to be Windows Computer objects.

Next – it defines that the group will contain entities in the <RelationshipClass> section, esentially building the containment relationship between the Group Class Instance, and the Windows Computer objects.

Last – it defines the expression to use to “match” on the defined property we chose (NetBIOS name) with a pattern (EX* wildcard)  We can match on ANY known attribute of a class… and NetBIOS name is but one of many on the Windows Computer class.

This understand will be a fundamental building block… for the next group posts… which will require that we see what is happening behind the scenes with a basic group, in order to use much more advanced groupings, that prove difficult or impossible to achieve in the console.

Leave a Reply

Your email address will not be published.