Overview of SharePoint Health Analyzer
Last modified: January 05, 2010
Applies to: SharePoint Foundation 2010
SharePoint Health Analyzer is a feature in Microsoft SharePoint Foundation 2010 that enables administrators to schedule regular, automatic checks for potential configuration, performance, and usage problems in the server farm. Any errors that SharePoint Health Analyzer finds are identified in status reports that are made available to farm administrators in Central Administration. Status reports explain each issue, list the servers where the problem exists, and outline the steps that an administrator can take to remedy the problem. In some cases, errors are repaired automatically as soon as they are found, and farm administrators are informed of the repairs.
SharePoint Health Analyzer monitors the farm by applying a set of health rules. A number of these rules ship with SharePoint Foundation. You can create and deploy additional rules by writing code that uses the SharePoint Foundation object model.
Health rules are executable code. Each rule is a concrete subclass that inherits from either one of two abstract classes: SPHealthAnalysisRule or SPRepairableHealthAnalysisRule. In both cases, the code that detects and reports a potential problem is in the Check() method. Repairable health rules also have a Repair() method that fixes a problem found by the Check method.
Rules are deployed in compiled assemblies and registered with the SharePoint Health Analyzer by calling the RegisterRules(Assembly) method of the SPHealthAnalyzer class. When a rule is registered, a timer job is created to run the rule by using default parameters that are specified by the rule's AutomaticExecutionParameters property. In addition, an item for the rule is added to the Health Analyzer Rule list. You can review rule definitions by clicking Review rule definitions under Health Analyzer in the Monitoring section of Central Administration.
A farm administrator can use the Health Analyzer Rule list to edit the settings for a rule, change where or when the rule runs, or even disable the rule altogether. If a rule is designed to repair an error automatically, a farm administrator can disable that feature without disabling the error-checking capability of the rule.
You can access the Health Analyzer Rule list programmatically through the static Local property of the SPHealthRulesList class, a subclass of SPList. After you have an instance of the SPHealthRulesList class, you can query the list as you would query any SPList object.
The SPHealthRulesList object that is returned by the Local property uses unmanaged resources. You are responsible for releasing those resources. One way to do that is to call the Dispose() method when you no longer need the object.
When a health rule executes, SharePoint Health Analyzer creates a status report and adds it to the Health Analyzer Reports list in the Monitoring section of Central Administration. The default view of this list displays only items that failed the most recent health check. You can review the archived reports by clicking Review problems and solutions under Health Analyzer in the Monitoring section of Central Administration.
You can access the Health Reports list programmatically through the static Local property of the SPHealthReportsList class, a subclass of SPList. After you have an instance of the SPHealthReportsList class, you can query the list as you would any SPList object. For an example, see the Local property.
The SPHealthReportsList object that is returned by the Local property uses unmanaged resources. You are responsible for releasing those resources. One way to do that is to call the Dispose() method when you no longer need the object.