SCOM: Exclude a group of objects from another group of objects

Consider the situation in which you have a group in SCOM with dynamic members and you need to exclude a subset of the membership based on another group with dynamic members. This may occur with a group used for monitoring in a 7×24 environment; some SCOM objects may not need to be monitored, thus needing to be excluded from the 7×24 monitoring group used for alerting.

Kevin Holman’s System Center Blog is the inspiration for this post but here I’ll describe in detail how to exclude SCOM objects as opposed to Windows Computer objects.  There is not a straightforward change in the GUI that can accomplish the goal. The underlying management pack XML must be modified since there is a lack of a Not expression when creating group membership from the GUI.

The steps that must be completed to exclude a group of objects from another group of objects is the following at a high level.

  • Create a new group with dynamic group membership.
  • Put the new group into a new management pack.
  • Create a second group with dynamic group membership and put it into the new management pack.
  • Export and modify the management pack XML to exclude one group of objects from another group of objects.
  • Import the management pack back into SCOM
  • Verify that the changes exclude a group of objects from another group of objects.

For this exercise we will use these groups:

  • Test 7×24 – Contains all production objects.
  • Test Non 7×24 – Contains a subset of the members found in Test 7×24 which may be pre-production or overly chatty objects that require alert tuning.

Create a new group and name it “test 7×24”.

Create a new group in SCOM

Create new management pack, name it “Test Group Exclusion”. Click create to create the management pack.

Create a new management pack in SCOM

Next use the drop down to select “object” and click the Add button.  Then use insert and use “Display name” for the property then use “Contains” for the operator.  Finally enter the unique value of objects within your environment.  This example will include all objects with DN1, DN2, DN3, or DN4 which coincide with Exchange 2010 DAG node mailbox servers.  The last thing to do is to switch to using OR group by right clicking the text “AND group for Object (all of these are true)” and select “Switch to OR Group”.  Below is screenshot of what the group will look like before the XML file is edited.

Set up dynamic membership for group

Create a second group and name it “Test Non 7×24”. Select the same management pack that was created earlier which was named “Test Group Exclusion”.

On the Dynamic Members configuration click the create/edit rules and specify “Object”. Using the same setup as above in the Test 7×24 group, specify a subset of members.  For simplicity this example specifies DN1 and will be used to exclude these objects from the Test 7×24 group.  Finalize creating the groups by clicking through the remaining steps of the wizard.  Below is screenshot of what the group will look like before the XML file is edited.

Create a new group in SCOM

In the navigation pane select administration and then select management packs.  Locate the newly created management pack and export it.

Edit the management pack and identify the element ID for each group.  These are located at the very end of the file:

Use the element ID for Test 7×24 to find the line with a matching GroupInstanceID:

The first instance of an expression below this must be modified to include an AND expression.

Before:

After:

Additionally at the bottom of the same list of regular expressions the group to exclude is inserted with a NotContained expression.  The NotContained section must include the element ID of the group of objects that will be excluded from the 7×24 group.

Before:

After:

Save the changes and import the management pack.  If you have made any errors the management pack import process will show an error and will fail on import.

Now it is time to review the groups after the changes made to the management pack. Switch to the Administration view in the navigation pane and display the properties of the Test Non 7×24 group and click the create/edit rules button on the dynamic members tab.  The default behavior is to use an AND group and you’ll notice that even though initially an OR group was used; the logic has reverted to default.  If you use additional expressions be sure to switch the logic to OR group otherwise the dynamic membership will not work, you’ll not have any group members.

Group default is to use AND group

Confirm that the Test Non 7×24 group contains the objects that should be excluded in the Test 7×24 group membership.  To verify the group membership right click on the Test Non 7×24 group and select View Group Members…

Next display the properties of the Test 7×24 group and view the dynamic members tab and click the create/edit rules.  There will be an error displayed for an unhandled exception which is related to the NotContained expression inserted into the management pack.

Expression causes error on SCOM group

Click continue on the error message to view the dynamic members query.  The query now contains an AND group as well as an OR group.  The last expression within the OR group will be blank, do not delete it.  This blank expression in the GUI represents the NotContained expression inserted into the management pack.

exclude a group of objects from another group of objects

Finally, confirm that the Test 7×24 group membership does not contain the objects that are members of the Test Non 7×24 group (the membership can take some time to update). To verify the group membership right click on the Test 7×24 group and select View Group Members…

If you have done everything correctly the group members in Test Non 7×24 should not be found in the Test 7×24 group.