Friday, May 30, 2014

Why Health Doesn't Roll Up?

This problem appeared in SCOM 2012 RTM so I will talk about this version. The issue persists in all versions up to 2012 R2.

We need to understand how health rollup works to answer this question.
There is a workflow on SCOM Server which goes through the database and implements health roll up. It searches for the objects which need their health to be updated. It does not roll up health for all entities in  one run. There are thousands of them and such implementation would cause huge performance impact on server.
After working with numerous environments we've figured out that Health Rollup Workflow skips entities which are being changed very often. A typical scenario to reproduce rollup problem is to reinstall the same Management Pack many times.
When you develop a pack usually you make some changes and install the new version in your dev SCOM just to verify the improvements work. However sometimes you make changes which break the compatibility with previous versions of MP and you have to remove it before deployment of new one.
The trick is that SCOM doesn't remove discovered entities from the database right away after MP uninstallation. It just marks them as deleted. So when you install MP again you rediscover the same object with the same GUID and there is a huge chance that Health Rollup MP will skip it and you'll see the sad picture:

If you hit this issue, you could try to restart System Center Management service (Monitoring Service in 2012 R2) but in most cases it doesn't help.

You'll ask me what to do if you develop and just need to reinstall and you need health to be rolled up?
There is a hope! I've invented one trick how to get instant rollup guarantee.
I'll post it in one of the next posts, dear diary. Follow up.

Health Rollup to Singleton Auto-Populated Group

I was developing architecture where I discover couple hosted objects on agents which are contained in one System.Group. This group is a singleton and I used Microsoft.SystemCenter.GroupPopulator as a Data Source for discovery populating group with hosted objects.

<ClassTypes>
   <ClassType ID="SingletonGroup" Base="System!System.Group"

              Accessibility="Public" Abstract="false"
              Hosted="false" Singleton="true">
</ClassType>
 

...
<Discovery ID="SingletonGroupDiscovery" Enabled="true"
           Target="SingletonGroup"
           ConfirmDelivery="true" Remotable="true" Priority="Normal">
 <Category>Discovery</Category>
 <DiscoveryTypes>
   <DiscoveryClass TypeID="SingletonGroup" />
 </DiscoveryTypes>
 <DataSource ID="DiscoveryDataSource"
              TypeID="SC!Microsoft.SystemCenter.GroupPopulator">
   <RuleId>$MPElement$</RuleId>
   <GroupInstanceId>$Target/Id$</GroupInstanceId>
   <MembershipRules>
     <MembershipRule>
       <MonitoringClass>$MPElement[Name="HostedObject1"]$</MonitoringClass>
       <RelationshipClass>$MPElement[Name="Relationship.SingletonGroupContainsHostedObject1"]$</RelationshipClass>
     </MembershipRule>
     <MembershipRule>
       <MonitoringClass>$MPElement[Name="HostedObject2"]$</MonitoringClass>
       <RelationshipClass>$MPElement[Name="Relationship.SingletonGroupContainsHostedObject2"]$</RelationshipClass>
      </MembershipRule>
    </MembershipRules>
  </DataSource>
</Discovery> 
There was an option to create specific class instead of inheriting from System.Group, but then it would be necessary to implement discovery which creates relationships between group and hosted object, so I've picked a way with basic System.Group to keep things simple.
Implementation was easy and fast, then a quick verification that all objects and relations are being created, and done!
The next day tester informed me that he can't get health roll up from hosted objects to the group. That was confusing cause I didn't expect any troubles with that part - I had all necessary Dependency Monitors implemented.
So I had to ask myself a question: is it possible to roll up health from objects created and hosted by agent to a group which is auto-populated singleton.

Today I can answer this question positively. I've spend some time verifying this in dev environment. Health DOES ROLL UP.

But what was the problem in Test environment? Why health wasn't rolled up in a reasonable time?
That is a complicate problem, dear diary. I will answer these questions in a different post.
Right now I can say that it was not a problem of Management Pack code.

Thursday, May 29, 2014

Dear Diary...

Dear Diary,

I've been developing Management Packs for Microsoft System Center Operations Manager for almost three years. During this long time I've collected so much information about this system that I cannot keep it in my head. I really need to store it somewhere. So this is your destiny, dear friend - keep the knowledge safe and easy for search.