Kevin Holman's System Center Blog

Posts in this blog are provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified in the Terms of UseAre you interested in having a dedicated engineer that will be your Mic

Creating Groups of Health Service Watcher Objects based on other Groups

Creating Groups of Health Service Watcher Objects based on other Groups

  • Comments 7
  • Likes


It has been a well known requirement for most customers, to be able to Create Groups of Windows Computers that also contain corresponding Health Service Watcher objects.  This was needed for Alert Notification subscriptions so that different teams could receive alert notifications filtered by groups, but also include alerts from the Watcher, such as Heartbeat failure and Computer Unreachable.  There are several articles on this but I will reference a very popular one, on Tims’ site:

Essentially, we needed to add an extra membership rule, to the XML, that would also add any Health Service Watcher objects that have a relationship to the Windows Computer objects already in the group.  We did this with the following XML:

<MembershipRule> <MonitoringClass>$MPElement[Name="SC!Microsoft.SystemCenter.HealthServiceWatcher"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="SC!Microsoft.SystemCenter.HealthService"]$</MonitoringClass> <Expression> <Contained> <MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</MonitoringClass> <Expression> <Contained> <MonitoringClass>$Target/Id$</MonitoringClass> </Contained> </Expression> </Contained> </Expression> </Contains> </Expression> </MembershipRule>

However, what if we ONLY want a group of Health Service Watcher objects, and NOT the Windows Computers.  BUT – we wish to based the HSW membership list from another group of Windows Computers.  This is useful if we want to create availability reports for a group of Windows Computers, but need to based the report on the availability of a specific up/down monitor, and not anything related to Windows Computer objects.

Here is a code example of exactly that:

In this sample – we will create a simple group of Windows Computers, that start with the name “DB”.  Then – we will create another group only containing HSW objects, corresponding the SQL computers group.

<ManagementPack ContentReadable="true" xmlns:xsd="" xmlns:xsl=""> <Manifest> <Identity> <ID>grouptest</ID> <Version></Version> </Identity> <Name>grouptest</Name> <References> <Reference Alias="MSCIGL"> <ID>Microsoft.SystemCenter.InstanceGroup.Library</ID> <Version>6.1.7221.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="SC"> <ID>Microsoft.SystemCenter.Library</ID> <Version>6.1.7221.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="Windows"> <ID>Microsoft.Windows.Library</ID> <Version>6.1.7221.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="Health"> <ID>System.Health.Library</ID> <Version>6.1.7221.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="System"> <ID>System.Library</ID> <Version>6.1.7221.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> </References> </Manifest> <TypeDefinitions> <EntityTypes> <ClassTypes> <ClassType ID="grouptest.compgroup" Accessibility="Internal" Abstract="false" Base="SC!Microsoft.SystemCenter.ComputerGroup" Hosted="false" Singleton="true" /> <ClassType ID="grouptest.SQLWatchers" Accessibility="Internal" Abstract="false" Base="MSCIGL!Microsoft.SystemCenter.InstanceGroup" Hosted="false" Singleton="true" /> </ClassTypes> </EntityTypes> </TypeDefinitions> <Monitoring> <Discoveries> <Discovery ID="grouptest.DiscoverSQLServersComputerGroup" Enabled="true" Target="grouptest.compgroup" ConfirmDelivery="true" Remotable="true" Priority="Normal"> <Category>Discovery</Category> <DiscoveryTypes> <DiscoveryRelationship TypeID="SC!Microsoft.SystemCenter.ComputerGroupContainsComputer" /> </DiscoveryTypes> <DataSource ID="GP" TypeID="SC!Microsoft.SystemCenter.GroupPopulator"> <RuleId>$MPElement$</RuleId> <GroupInstanceId>$MPElement[Name="grouptest.compgroup"]$</GroupInstanceId> <MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="SC!Microsoft.SystemCenter.ComputerGroupContainsComputer"]$</RelationshipClass> <Expression> <RegExExpression> <ValueExpression> <Property>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Property> </ValueExpression> <Operator>MatchesWildcard</Operator> <Pattern>DB*</Pattern> </RegExExpression> </Expression> </MembershipRule> </MembershipRules> </DataSource> </Discovery> <Discovery ID="grouptest.DiscoverSQLWatchers" Enabled="true" Target="grouptest.SQLWatchers" ConfirmDelivery="true" Remotable="true" Priority="Normal"> <Category>Discovery</Category> <DiscoveryTypes> <DiscoveryRelationship TypeID="MSCIGL!Microsoft.SystemCenter.InstanceGroupContainsEntities" /> </DiscoveryTypes> <DataSource ID="GP" TypeID="SC!Microsoft.SystemCenter.GroupPopulator"> <RuleId>$MPElement$</RuleId> <GroupInstanceId>$MPElement[Name="grouptest.SQLWatchers"]$</GroupInstanceId> <MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="SC!Microsoft.SystemCenter.HealthServiceWatcher"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MSCIGL!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="SC!Microsoft.SystemCenter.HealthService"]$</MonitoringClass> <Expression> <Contained> <MonitoringClass>$MPElement[Name="grouptest.compgroup"]$</MonitoringClass> </Contained> </Expression> </Contains> </Expression> </MembershipRule> </MembershipRules> </DataSource> </Discovery> </Discoveries> </Monitoring> <LanguagePacks> <LanguagePack ID="ENU" IsDefault="true"> <DisplayStrings> <DisplayString ElementID="grouptest"> <Name>Group Test</Name> <Description /> </DisplayString> <DisplayString ElementID="grouptest.compgroup"> <Name>SQL Servers Computer Group</Name> </DisplayString> <DisplayString ElementID="grouptest.DiscoverSQLServersComputerGroup"> <Name>Discovery for SQL Servers Computer Group</Name> </DisplayString> <DisplayString ElementID="grouptest.DiscoverSQLWatchers"> <Name>Discovery for SQL Health Service Watchers Group</Name> <Description /> </DisplayString> <DisplayString ElementID="grouptest.SQLWatchers"> <Name>SQL Health Service Watchers Group</Name> </DisplayString> </DisplayStrings> </LanguagePack> </LanguagePacks> </ManagementPack>


The key to this is the specific reference of the other group – shown here:

<MembershipRules> <MembershipRule> <MonitoringClass>$MPElement[Name="SC!Microsoft.SystemCenter.HealthServiceWatcher"]$</MonitoringClass> <RelationshipClass>$MPElement[Name="MSCIGL!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass> <Expression> <Contains> <MonitoringClass>$MPElement[Name="SC!Microsoft.SystemCenter.HealthService"]$</MonitoringClass> <Expression> <Contained> <MonitoringClass>$MPElement[Name="grouptest.compgroup"]$</MonitoringClass> </Contained> </Expression> </Contains> </Expression> </MembershipRule> </MembershipRules>
  • Am I missing something? Can't this also be achieved by creating a group with dynamic membership based on server name, for example, that adds both the Computer object and the HSW object?

  • @Rupert - yes - I think you are oversimplifying. The customer in this case wanted to specifically create a group of HSW instances ONLY, for the purposes of availability reporting. They did not want computers and HSW's, hence this example, which is something completely different.

  • @Kevin - I would just like to esquire about the code. Is it specifically for the 2012x system or can it be used on 2007 as well?

  • Hi Kevin. I want to create a group which will have Windows Server Operating System objects (and not the Windows Computer objects) based on OU (Organizational Unit) and their related Health Service Watcher (which I know will have to come from Windows Computer objects...). Well I succeeded, but the thing is when I create a new State view based on that group, I see also the Health Service objects.. How can I eliminate them?


  • @ Yaniv -

    Easy. Create a state view. Scope it to class of Windows Server OS, then filter it by the custom group.

  • @ Kevin :-),

    he he ... Yes I know that...

    Maybe I skipped some details: I created a custom group to have Windows Server OS + Health Service Watcher objects. When I go to SCOM Console -> Authoring -> Groups -> MyCustomGroup -> View Members, I get what I asked and that is both, Windows Server OS and Health Service Watcher objects. Great. Now, I created new State view and left in "Show data related to:" OBJECT. In "Show data contained in a specific group:" I targeted to MyCustomGroup (which gave me WSOS + HSW objects...). Now I am expecting to see ONLY WSOS + HSW objects BUT I see also "Health Service" objects. I want to get rid of the Health Service objects... Is it possible (since there is a relationship defined between HSW and HS classes...) ?

    My apologies for the looooong explaination :-)


  • Oh, I see. That's weird - and you are right there must be some relationship that does this. I'd have to play around. It is a pity that our group criteria does not support "anding" of multiple object types instead of the way it is, with only being able to select OBJECT (all) or a single specific class.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
Search Blogs