Working with the SharePoint Health Analyzer in SharePoint Foundation 2010


In this article, we will take a look at the features of the SharePoint Health Analyzer in SharePoint Foundation 2010 and some details on extending it by creating custom Health Rules.

What is the SharePoint Health Analyzer?

  • Provides a tool for admins to schedule automatic checks
  • Can maintain the farm health against potential configuration, performance and usage problems.
  • Health checks are implemented through Health Rules
  • Rules List is available on Central Admin - Monitoring - Health Analyzer - Review rule definitions. Use the Rule list to edit settings or disable the rule.
  • Used at Farm level. 
What is a Health Rule?
  • Many health rules are provide OOTB and custom health rules can be created.
  • Works on farm level and is a preventive aid.
  • It monitors configuration, performance, availability or security.
  • Designed to be short and simple. Should not place load on farm resources.
  • Work on a periodic schedule as set by the Farm Administrator 
  • A Rule = Assembly - Derives from SPHealthAnalysisRule or SPRepairableHealthAnalysisRule
  • Rule classes implement the Check() method: detect and report a health issue
  • Repairable rules additionally implement the Repair() method
  • The following inherited properties are also implemented in the Rule class - Summary, Explanation, Remedy, Category and ErrorLevel properties, AutomaticExecutionParameters property
  • AutomaticExecutionParameters property - default settings for the timer job to schedule the Rule processing. 
  • Once the Health Rule is developed, it can be tested by instantiating the Rule class, invoking the Check() method and validating the method's return value. 
  • Deployment - can done through a Feature - in the FeatureActivate Event Handler, the Rule is registered by invoking the SPHealthAnalyzer.RegisterRule(Assembly) method.
  • RegisterRule method - creates a timer job with the frequency based on Rule's AutomaticExecutionParameters property and adds an item for the rule in the Health Analyzer Rule list.
  • In the long term, the deployment is usually handled through a Solution to provide ease of maintenance within the server farm. 
How is Rule Administration handled? 
  • Rule Administration: Administrators view and edit settings for Health Rules via the Rules List through Central Admin.
  • Rules List in the Object Model: SPHealthRulesList - Subclass of SPList
  • Rules List: SPHealthRulesList.Local property (uses unmanaged resources - disposal handled by the developer) 
Where can the Health Check Results be accessed?
  • The Health check results are provided in the form of Status reports available on the Central Administration site.
  • Reports contain info on the issue, the servers associated with the problem and steps for remedy.
  • Automatic repairs are carried out where configured and are logged in the Status Report.
  • Results of the latest health check: Central Admin - Monitoring - Health Analyzer Reports list
  • Archived health check results: Central Admin - Monitoring - Health Analyzer - Review problems and solutions - archived reports
  • In the Server Object Model, SPHealthReportsList (subclass of SPList) - through SPHealthReportsList.Local
Conclusion

I hope this article gave you a good overview of the Health Rule Analyzer and it's components. We also took a look at corresponding classes in the Server Object Model. The automated analysis and self-repair features can provide a valuable offering towards a stable and secure SharePoint implementation.