Hey all, I saw an interesting discussion today about creating new health rules in SharePoint 2010 and thought I would share. All the credit for this one goes to Chris C. who was good enough to share this information. The discussion started because of some confusion about how to add a new health rule. In the public beta you can go into Central Admin, hit up the rule definitions and add a new one. Unfortunately you will find that doesn’t really work. By RTM we should / will have the new rule definition button disabled, because that isn’t the right way to get it into the system. Instead, here in Chris’ words are how you should approach this.
A health rule is basically a class (derived from either SPHealthAnalysisRule or SPRepairableHealthAnalysisRule) which implements a Check() method, some string properties that describe the problem to the administrator, and optionally a Repair() method (if an SPRepairableHealthAnalysisRule).
For adding health rules to your farm:
- Create your class and compile it into a dll with a strong name
- GAC the dll on each of the machines in your farm
- Run the following In OM/PowerShell:
$asm=[System.Reflection.Assembly]::LoadFrom($loc) <- $asm should be GAC’d
Once these steps are complete, you should see your rule(s) in the Health Rules List (i.e. http://centraladmin:8080/Lists/HealthRules/AllItems.aspx). This is the full list of rules. Each of these runs on a different schedule (defined in the class) inside of a timer job. Once a rule is run, a result list item is stored in the health reports (or “Problems and Solutions”) list. The reason you are not seeing any generated reports is most likely because your OOB rules have not been run yet.
Thanks again Chris for sharing this valuable information.