run monitor on custom resourcepool

Hansi 116 Reputation points
2022-10-04T07:29:09.157+00:00

Hello!

I have created a custom resourcepool with the template of https://github.com/QuaeNocentDocent/OMS-ManagementPack/blob/master/QND.OMS/Pool.mpx

ID="My.WatcherResourcePool.Class"  
   Base="SC!Microsoft.SystemCenter.ManagementServicePool"  
   Accessibility="Public"  
   Abstract="false"  
   Hosted="false"  
   Singleton="true">  

The discovery is running fine

<Discovery ID="My.WatcherResourcePool.Discovery"  
  Enabled="true"  
  Target="My.WatcherResourcePool.Class"  
  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>  
  

After Importing MP I have added two server to the Resourcepool.

No I created a Test-Class that is discovered on the "My.WatcherResourcePool.Class". All is running fine. The discovery is running on one of the servers in the Resourcepool.

But when i running a monitor on the Class-Instances, the monitor is running on one of the Server of All.Management.ResourePool.
--> What do I have to do, that the Monitor is running on a server of the custom resourcepool?

The Discovery is writing in Event-Log with ID 19100
The Monitor is writing in Event-Log with ID 19101

TestClass:

<ClassType ID="Test.RP.Watcher.BBB.Class" Accessibility="Public" Abstract="false" Base="Windows!Microsoft.Windows.ApplicationComponent" Hosted="true" Singleton="false" Extension="false">  
  <Property ID="ID" Type="string" AutoIncrement="false" Key="true" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" />  
  <Property ID="PropertyB" Type="string" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="false" Scale="0" />  
</ClassType>  

Relationship to RP:
<RelationshipType ID="My.Test.RP.Watcher.Class.Hosts.Class.B.Relationship" Accessibility="Public" Abstract="false" Base="System!System.Hosting">
<Source ID="Source" MinCardinality="0" MaxCardinality="2147483647" Type="RP!My.Basic.WatcherResourcePool.Class" />
<Target ID="Target" MinCardinality="0" MaxCardinality="2147483647" Type="Test.RP.Watcher.BBB.Class" />
</RelationshipType>

Discovery on RP:

<Discovery ID="Test.RP.Watcher.BBB.Class.Discovery" Enabled="true" Target="RP!My.Basic.WatcherResourcePool.Class" ConfirmDelivery="false" Remotable="true" Priority="Normal">  
  <Category>Discovery</Category>  
  <DiscoveryTypes>  
 <DiscoveryClass TypeID="Test.RP.Watcher.BBB.Class">  
   <Property TypeID="Test.RP.Watcher.BBB.Class" PropertyID="ID" />  
   <Property TypeID="Test.RP.Watcher.BBB.Class" PropertyID="PropertyB" />  
   <Property TypeID="System!System.Entity" PropertyID="DisplayName" />  
 </DiscoveryClass>  
  </DiscoveryTypes>  
  <DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">  
 <IntervalSeconds>300</IntervalSeconds>  
 <SyncTime></SyncTime>  
 <ScriptName>DiscoveryB.ps1</ScriptName>  
 <ScriptBody>param($SourceId,$ManagedEntityId)  
  
#$SourceId = '{00000000-0000-0000-0000-000000000000}'  
#$ManagedEntityId = '{00000000-0000-0000-0000-000000000000}'  
$ComputerIdentity = "$env:computername.$env:userdnsdomain"  
$whoami = whoami  
$ScriptName = "DiscoveryB.ps1"  
$EventID = "19100"  
  
# API object for MOM  
$api = New-Object -comObject "MOM.ScriptAPI"  
  
# Discovery data  
$discovery = $api.CreateDiscoveryData(0, $SourceId, $ManagedEntityId)  
  
$api.LogScriptEvent($ScriptName,$EventID,0,"Start Discovery of Class BBB.")  
  
  
$instance = $discovery.CreateClassInstance("$MPElement[Name='Test.RP.Watcher.BBB.Class']$")  
 $instance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "DN: Property B-1")  
 $instance.AddProperty("$MPElement[Name='GRZ.Test.RP.Watcher.BBB.Class']/ID$", "111")  
 $instance.AddProperty("$MPElement[Name='Test.RP.Watcher.BBB.Class']/PropertyB$", "Property B-1")  
 $discovery.AddInstance($instance)  
  
$instance = $discovery.CreateClassInstance("$MPElement[Name='Test.RP.Watcher.BBB.Class']$")  
 $instance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "DN: Property B-2")  
 $instance.AddProperty("$MPElement[Name='GRZ.Test.RP.Watcher.BBB.Class']/ID$", "222")  
 $instance.AddProperty("$MPElement[Name='Test.RP.Watcher.BBB.Class']/PropertyB$", "Property B-2")  
 $discovery.AddInstance($instance)  
  
$discovery  
  
$api.LogScriptEvent($ScriptName,$EventID,0,"End Discovery of Class BBB.")  
  
</ScriptBody>  
 <Parameters>  
   <Parameter>  
 <Name>SourceId</Name>  
 <Value>$MPElement$</Value>  
   </Parameter>  
   <Parameter>  
 <Name>ManagedEntityId</Name>  
 <Value>$Target/Id$</Value>  
   </Parameter>  
 </Parameters>  
 <TimeoutSeconds>120</TimeoutSeconds>  
 <StrictErrorHandling>false</StrictErrorHandling>  
  </DataSource>  
</Discovery>  
  

Monitor:

<UnitMonitor ID="Test.RP.Watcher.ClassB.Monitor" Accessibility="Public" Enabled="true" Target="My.Test.RP.Watcher.BBB.Class" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Test.RP.Watcher.ClassB.Monitor.UnitMonitorType" ConfirmDelivery="false">  
  <Category>AvailabilityHealth</Category>  
  <OperationalStates>  
    <OperationalState ID="OK" MonitorTypeStateID="OK" HealthState="Success" />  
    <OperationalState ID="WARNING" MonitorTypeStateID="WARNING" HealthState="Warning" />  
    <OperationalState ID="ERROR" MonitorTypeStateID="ERROR" HealthState="Error" />  
  </OperationalStates>  
  <Configuration>  
    <TimeoutSeconds>60</TimeoutSeconds>  
    <IntervalSeconds>60</IntervalSeconds>  
    <Data>$Target/Property[Type="My.Test.RP.Watcher.BBB.Class"]/ID$</Data>  
  </Configuration>  
</UnitMonitor  

rg
Hansi

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,421 questions
0 comments No comments
{count} votes