disclaimer
In this blog post, I will share a possible solution for a problem that I encountered in my work. However, I want to make it clear that this solution is not officially supported by Microsoft, and it may have some risks or side effects that I am not aware of. Therefore, use this solution at your own discretion and responsibility.

Do you want to monitor a service on two servers and get an alert if it fails on both? In this article, I will explain how I did it using a custom management pack and a dynamic application. I will also provide the link to the management pack and the instructions on how to modify it for your own service.

– Created a service Monitor based on the following solution.

https://github.com/somahato/Management-Packs/blob/master/Custom.MultipleServerService.Monitoring.ManagementPack.xml

– Now created DA and added only object for the class “Custom.MultipleService.Enabled.Class”.

– Now went to Discovered Inventory in Monitoring and select the class “Dual Service Monitoring”.

– Open Health explorer and expand the parent Monitor “Availability” and select “Component Group Health Roll-up for type Object” and open properties.

– Now go to “Health Rollup Policy” and Select “Worst state of the specified percentage of members in good health” policy and select 1.

– Now create an overrides to enable alerting as well.

– Now I could see alerting is working as per my requirement.

– I have shared the management pack in the below link and you need to change the following inside the management pack.

https://github.com/somahato/Management-Packs/blob/master/Custom.MultipleServerService.Monitoring.ManagementPack.xml

Action to be taken in your case:

1. Change the WMI query for the services customer wants to Monitor.

Line No: 126, 350

$Services = Get-WmiObject -Query "Select * from WIn32_Service Where (name like 'Audiosrv')"

For Multiple services, you can use below.

$Services = Get-WmiObject -Query "Select * from WIn32_Service Where (name like 'OMSDK' or name like 'CSHOST' or name like 'HealthService')"

2. Now run the following PowerShell query and get the IDs you want to add in the DA.

Get-SCOMClass -Name Custom.MultipleService.Enabled.Class | Get-SCOMClassInstance | Select FullName, ID

3. Once you got the IDs, replace the IDs inside the MP, starting Line No: 432. Do not remove the Curly brackets.

<IncludeList>
  <MonitoringObjectId>{f292d304-4e39-6870-477f-ea58fab4d03c}</MonitoringObjectId>
  <MonitoringObjectId>{25b4a268-581d-b8b0-45e2-5a43f6369c7e}</MonitoringObjectId>
  <MonitoringObjectId>{644fcf10-3291-583f-8b2d-c1d587f49683}</MonitoringObjectId>
</IncludeList>

4. Now save the MP and import it.