How to: Create a Definition Configuration XML File

 

Applies To: Windows Server 2012 Essentials, Windows Home Server 2011, Windows Storage Server 2008 R2 Essentials, Windows Small Business Server 2011 Essentials

You might need to change the configuration of your add-in, such as enabling or disabling a health check, or configuring the thresholds for conditions and actions. In this section, you create an XML file that contains the elements and attributes to configure a health add-in. For more information about the elements that are used in the Definition.xml.config file, see Definition Configuration XML Schema Reference.

To define the FeatureConfiguration element

  1. Open Visual Studio 2010 as an administrator by right-clicking the program in the Start menu and selecting Run as administrator.

  2. Open the MyHealthAddin project that you created in How to: Create a Definition XML File.

  3. In Solution Explorer, expand the MyHealthFeature folder, and then open the Definition.xml.config file.

  4. Every configuration file has one FeatureConfiguration element. Such as the following example:

    <FeatureConfiguration   
       xmlns="http://schema.microsoft.com/WindowsServerSolutions/2010/03/Health"  
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
       xsi:schemaLocation="http://schema.microsoft.com/WindowsServerSolutions/2010/03/Health ..\FeatureConfigurationSchema.xsd">  
    </FeatureConfiguration>  
    

To define the HealthDefinitionConfiguration element

  1. The FeatureConfiguration element can contain multiple HealthDefinitionConfiguration elements. In the Definition.xml.config file, the following HealthDefinitionConfiguration element is defined:

    <HealthDefinitionConfiguration Name="Alert1">  
       <Configurations>  
          <Enable>true</Enable>  
          <TimeInterval>PT12H0M0S</TimeInterval>  
          <Escalate>true</Escalate>  
       </Configurations>  
    
       <Arguments>  
          <Argument Name="DiskThreshold">20</Argument>  
          <Argument Name="Services">spooler;dns</Argument>  
       </Arguments>  
    </HealthDefinitionConfiguration>  
    

    In the Definition.xml.config file, change the Name attribute of the HealthDefinitionConfiguration element to the name that you used for the associated HealthDefinition element in the Definition.xml file.

  2. For each health definition, you can specify whether the health check is enabled, the frequency of the health check, and whether email notification is sent when an alert is raised. Under the Configurations element, set the Enabled element to true if you want the check to be enabled; otherwise, false. Set the TimeInterval element to specify the XML standard type of xs:duration. Set the Escalate element to true to enable email notification for this health definition; otherwise false.

    Note

    A scheduled task with an interval of 30 minutes is defined on the server for alert evaluations. Time intervals specified in the Definition.xml.config file that are less than 30 minutes are overridden by the default value of the scheduled task. Time intervals of more than 30 minutes can be defined by using the <TimeInterval> tag. For example, a time interval of 12 hours is defined as <TimeInterval>PT12H</TimeInterval>. For time intervals of less than 30 minutes, you must programmatically evaluate the health condition and raise alerts.

  3. Some scripts and programs that are associated to the actions defined for health definitions may need parameter values. Under the Arguments element, add an Argument element that contains the values that are needed for the actions that you use.

  4. Save the Definition.xml.config file.