Dynamic Computer groups that send heartbeat alerts
Something that has always puzzled me with MOM 2005 and now System Center Operations Manager 2007 is that when I create a dynamic group of computers and one of the computers goes offline I don’t get a heartbeat. This seems like something that should work “out of the box “as all other monitors are dependent upon the server being up. Last year I posted a tool called the “watchanator” that addressed this issue. The “watchanator” worked well but was complicated to setup and needed to be run every time the dynamic group changed. Well now I have a better solution. This new solution may seem a little complicated as well first but is really very easy if you follow my simple steps.
1. Create the dynamic group, using the group wizard.
a. Give your dynamic group a name and select the unsealed management pack you want to store the group in.
b. On the Explicit Members tab click next.
c. On the Dynamic Members tab click and create the formula you want to use to create you dynamic group. I used a simple one that dynamically includes all of my exchange servers.
d. From the groups window, right click to verify that your dynamic group includes the computers you want.
As you can see the dynamic group only contains windows servers and does not contain the heartbeat object
(or agent watcher as it is know in scom)
2. Export the Management pack
3. Open up the Management pack in any xml editor. I am using visual studio
4. Search for <MembershipRules>. The membership rules make up the dynamic group. As you can see the first membership rule between <MembershipRule> and </MembershipRule> contains the formula that creates my dynamic group.
5. Now we need to add the code to include the health watchers. Open up watchers.xml available at http://www.scom2k7.com/downloads/Watchers.xml and copy the xml code.
Here is the code.
<MembershipRule>
<MonitoringClass>$MPElement[Name="SystemCenter!Microsoft.SystemCenter.HealthServiceWatcher"]$</MonitoringClass>
<RelationshipClass>$MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$</RelationshipClass>
<Expression>
<Contains>
<MonitoringClass>$MPElement[Name="SystemCenter!Microsoft.SystemCenter.HealthService"]$</MonitoringClass>
<Expression>
<Contained>
<MonitoringClass>$MPElement[Name="MicrosoftWindowsLibrary6062780!Microsoft.Windows.Computer"]$</MonitoringClass>
<Expression>
<Contained>
<MonitoringClass>$Target/Id$</MonitoringClass>
</Contained>
</Expression>
</Contained>
</Expression>
</Contains>
</Expression>
</MembershipRule>
6. Paste this code after the first </MembershipRule> and before </MembershipRules> then save the file.
*Note if you choose another class other than Microsoft.Windows.Computer to create you dynamic group you will have to replace the line from watchers.xml with the matching line in your dynamic group membership rule.
<MonitoringClass>$MPElement[Name="MicrosoftWindowsLibrary6062780!Microsoft.Windows.Computer"]$</MonitoringClass>
7. Save the MP and re-import the Management Pack into SCOM
8. Go back to your group and right click View group members
9. The health watchers may up to 20 seconds to populate. Push F5 a couple of times to refresh the screen.
Now when we create a subscription to this group and a server in the group goes offline we will now get the heartbeat alert.
You download the sample management pack at http://www.scom2k7.com/downloads/Exchange.Servers.xml









CharlesC:
You can also add the agent using a dynamic rule query:
( Object is Agent AND ( Windows Computer.NetBIOS Computer Name Matches regular expression [^$]IPGD[0-3][13579] ) OR ( Windows Computer.NetBIOS Computer Name Matches regular expression SERVERIPGD0[13579] ) )
The query above will get all the Health Service agents for the computers that match the regular expressions. If you want to also include the Windows Computer ojbect just add another or. I had to use this specific dynamic group for clustered DB servers.
8 September 2008, 4:22 pmHaakon Roesberg:
can you find anything wrong in this rule?
$MPElement[Name="Windows!Microsoft.Windows.Computer"]/IPAddress$
MatchesWildcard
172.27.10.???
$MPElement[Name="SystemCenter!Microsoft.SystemCenter.HealthService"]$
$MPElement[Name="Windows!Microsoft.Windows.Server.Computer"]$
$Target/Id$
15 September 2008, 8:59 amFrancisco:
I cannot import the MP because I get the following error:
not sure what is causing this issue.
Error 1:
23 September 2008, 1:15 pm: Failed to verify Discovery [UINameSpace20d6ebe6b56b45a5b84c9ef2617ba047.Group.DiscoveryRule]
Failed to verify referenced module : ID=GroupPopulationDataSourceInvalid configuration specified for Module [GroupPopulationDataSource]Cannot find MPElement: MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities specified in expression: $MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$Cannot resolve identifier [MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities] in the context of ManagementPack [MultiHost.Ping]. Unknown alias [MicrosoftSystemCenterInstanceGroupLibrary6062780]
——————————————————-
Failed to verify Discovery [UINameSpace20d6ebe6b56b45a5b84c9ef2617ba047.Group.DiscoveryRule] Failed to verify referenced module : ID=GroupPopulationDataSource Invalid configuration specified for Module [GroupPopulationDataSource] Cannot find MPElement: MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities specified in expression: $MPElement[Name="MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities"]$ Cannot resolve identifier [MicrosoftSystemCenterInstanceGroupLibrary6062780!Microsoft.SystemCenter.InstanceGroupContainsEntities] in the context of ManagementPack [MultiHost.Ping]. Unknown alias [MicrosoftSystemCenterInstanceGroupLibrary6062780]
Rory:
Francisco, it looks like your MultiHost.Ping Management Pack needs to have a reference added in the manifest section for the Microsoft MP [MicrosoftSystemCenterInstanceGroupLibrary6062780]. Try adding this and importing the MP or running MPVerify.exe against the MP. MPVerify is also built into the Authoring Console.
For this and more information on SCOM, check out our training at http://www.infrontconsulting.com/events.htm.
2 October 2008, 9:48 pm