question

hansi4711 avatar image
0 Votes"
hansi4711 asked hansi4711 edited

Group with Servers of a Resource Pool

Hello!

I want to create a group with all Servers that are members of a specific Resource Pool.

How can I do this?

rg
Hansi

msc-operations-manager
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

XinGuo-MSFT avatar image
0 Votes"
XinGuo-MSFT answered

Hi,

Based on my understanding, SCOM no such built-in function, we can create such groups through Powershell.

We could refer to the following documents to write our Powershell script.

SCOM getting resource pool members with powershell

Automate SCOM Group Creation

Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

CyrAz avatar image
0 Votes"
CyrAz answered CyrAz edited

I have in mind another option that relies purely on authoring, but I can't test it for now so I'm not entirely sure it could work the way I imagine it.
Anyway :
Hunder the hood, a resource pool is basically a singleton class (class with only one instance) linked to its members (instances of management server class) by a containment relationship. Which is also literally what a regular group is, with the slight difference of the base class used for the singleton class.
And it is possible to author a group of objects that are contained in another group.
So I'm fairly confident that it should be possible to author a group of objects that are contained in a resource pool... but as I said, I haven't tested it.

You could try something based on that example : https://kevinholman.com/2010/09/09/how-to-create-a-group-of-objects-that-are-contained-by-some-other-group/

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

hansi4711 avatar image
0 Votes"
hansi4711 answered hansi4711 edited

Hello!
Thank you for answer. I have tried it and I think I have a mistake in code.
Here are my fragments.

My Resourcepool Class:

 <ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <TypeDefinitions>
  <EntityTypes>
    <ClassTypes>
  <ClassType ID="My.ResourcePool.Class" 
     Base="SC!Microsoft.SystemCenter.ManagementServicePool" 
     Accessibility="Public" 
     Abstract="false" 
     Hosted="false" 
     Singleton="true"/>
    </ClassTypes>
  </EntityTypes>
   </TypeDefinitions>
   <LanguagePacks>
  <LanguagePack ID="ENU" IsDefault="true">
    <DisplayStrings>
  <DisplayString ElementID="My.ResourcePool.Class">
    <Name>My Resource Pool</Name>
  </DisplayString>
    </DisplayStrings>
  </LanguagePack>
   </LanguagePacks>
 </ManagementPackFragment>




The Discovery of ResourcePool Class:

 <ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Monitoring>
  <Discoveries>
    <Discovery ID="My.ResourcePool.Class.Discovery"
   Enabled="true"
   Target="My.ResourcePoolClass"
   ConfirmDelivery="false"
   Remotable="true"
   Priority="Normal">
  <Category>Discovery</Category>
  <DiscoveryTypes>
    <DiscoveryClass TypeID="SC!Microsoft.SystemCenter.ManagementServicePoolWatcher">
  <Property TypeID="System!System.Entity" PropertyID="DisplayName" />
  <Property PropertyID="PoolId" />
  <Property PropertyID="PoolName" />
    </DiscoveryClass>
  </DiscoveryTypes>
  <DataSource ID="DS" TypeID="My.ResourcePool.Class.DataSource">
    <IntervalSeconds>120</IntervalSeconds>
  </DataSource>
    </Discovery>
  </Discoveries>
    </Monitoring>
 </ManagementPackFragment>
    
 <ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <TypeDefinitions>
  <ModuleTypes>
    <DataSourceModuleType ID="My.ResourcePool.Class.DataSource" Accessibility="Public" Batching="false">
  <Configuration>
    <xsd:element name="IntervalSeconds" type="xsd:integer" />
  </Configuration>
  <OverrideableParameters>
    <OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
  </OverrideableParameters>
  <ModuleImplementation Isolation="Any">
    <Composite>
  <MemberModules>
    <DataSource ID="Scheduler" TypeID="System!System.Discovery.Scheduler">
  <Scheduler>
    <SimpleReccuringSchedule>
  <Interval>$Config/IntervalSeconds$</Interval>
  <SyncTime />
    </SimpleReccuringSchedule>
    <ExcludeDates />
  </Scheduler>
    </DataSource>
    <ConditionDetection ID="Mapper" TypeID="System!System.Discovery.ClassSnapshotDataMapper">
  <ClassId>$MPElement[Name="SC!Microsoft.SystemCenter.ManagementServicePoolWatcher"]$</ClassId>
  <InstanceSettings>
    <Settings>
  <Setting>
    <Name>$MPElement[Name="SC!Microsoft.SystemCenter.ManagementServicePoolWatcher"]/PoolId$</Name>
    <Value>$Target/Id$</Value>
  </Setting>
  <Setting>
    <Name>$MPElement[Name="SC!Microsoft.SystemCenter.ManagementServicePoolWatcher"]/PoolName$</Name>
    <Value>$Target/Property[Type="System!System.Entity"]/DisplayName$</Value>
  </Setting>
  <Setting>
    <Name>$MPElement[Name="System!System.Entity"]/DisplayName$</Name>
    <Value>$Target/Property[Type="System!System.Entity"]/DisplayName$ Watcher</Value>
  </Setting>
    </Settings>
  </InstanceSettings>
    </ConditionDetection>
  </MemberModules>
  <Composition>
    <Node ID="Mapper">
  <Node ID="Scheduler" />
    </Node>
  </Composition>
    </Composite>
  </ModuleImplementation>
  <OutputType>System!System.Discovery.Data</OutputType>
    </DataSourceModuleType>
  </ModuleTypes>
   </TypeDefinitions>
 </ManagementPackFragment>


After Installing I have set Pool to manual and added a ManagagementServer.


Here is the Group:

 <ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <TypeDefinitions>
  <EntityTypes>
    <ClassTypes>
  <ClassType ID="My.ResourcePool.Server.Group"
     Base="MSIL!Microsoft.SystemCenter.InstanceGroup"
     Accessibility="Internal"
     Abstract="false"
     Hosted="false"
     Singleton="true">
  </ClassType>
    </ClassTypes>
  </EntityTypes>
   </TypeDefinitions>
  <LanguagePacks>
  <LanguagePack ID="ENU" IsDefault="true">
    <DisplayStrings>
  <DisplayString ElementID="My.ResourcePool.Server.Group">
    <Name>My ResourcePool Server Group</Name>
  </DisplayString>
    </DisplayStrings>
  </LanguagePack>
   </LanguagePacks>
 </ManagementPackFragment>



Now I tried the discovery for the group:

 <ManagementPackFragment SchemaVersion="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <Monitoring>
  <Discoveries>
    <Discovery ID="My.ResourcePool.Server.Group.Discovery"
   Enabled="true"
   Target="My.ResourcePool.Server.Group"
   ConfirmDelivery="false"
   Remotable="true"
   Priority="Normal">
  <Category>Discovery</Category>
  <DiscoveryTypes>
    <DiscoveryRelationship TypeID="MSIL!Microsoft.SystemCenter.InstanceGroupContainsEntities" />
  </DiscoveryTypes>
  <DataSource ID="GroupPopulationDataSource" TypeID="SC!Microsoft.SystemCenter.GroupPopulator">
    <RuleId>$MPElement$</RuleId>
    <GroupInstanceId>$Target/Id$</GroupInstanceId>
    <MembershipRules>
  <MembershipRule>
    <MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</MonitoringClass>
    <RelationshipClass>$MPElement[Name="MSIL!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass>
    <Expression>
  <Contained>
    <MonitoringClass>$MPElement[Name="SC!Microsoft.SystemCenter.ManagementServerComputersGroup"]$</MonitoringClass>
    <Expression>
  <Contained>
    <MonitoringClass>$MPElement[Name="My.ResourcePool.Class"]$</MonitoringClass>
  </Contained>
    </Expression>
  </Contained>
    </Expression>
  </MembershipRule>
    </MembershipRules>
  </DataSource>
    </Discovery>
  </Discoveries>
   </Monitoring>
 </ManagementPackFragment>



What is my goal? I want a Group with all "Windows Computer", that are "Management Servers" and this "Manager Servers" are members of "My Custom Resource Pool"


rg
Hansi



EDIT:
with

$(Get-SCOMResourcePool -Name "My.ResourcePool.Class").Members

I will get the Pool and the members of it. This I want to list in my Group

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.