<ManagementPack xsi:noNamespaceSchemaLocation="ManagementPackSchema.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Manifest>
    <Identity>
      <ID>System.Connectors.Library.Test</ID>
      <Version>6.0.0.0</Version>
    </Identity>
    <Name>System Connectors Library Test</Name>
    <References>
      <Reference Alias="System">
        <ID>System.Library</ID>
        <Version>6.0.5000.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="Health">
        <ID>System.Health.Library</ID>
        <Version>6.0.5000.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="SCLibrary">
        <ID>Microsoft.SystemCenter.Library</ID>
        <Version>6.0.5000.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="Performance">
        <ID>System.Performance.Library</ID>
        <Version>6.0.5000.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
    </References>
  </Manifest>
  <TypeDefinitions>
    <DataTypes>
    </DataTypes>
    <SchemaTypes>
    </SchemaTypes>
    <ModuleTypes>
      <!-- maps generic MOM data to an alert data, internal -->
      <ConditionDetectionModuleType ID="System.Connectors.GenericAlertMapper" Accessibility="Internal" Stateful="false" PassThrough="false" Batching="false">
        <Configuration>
          <IncludeSchemaTypes>
            <SchemaType>Health!System.Health.AlertSchema</SchemaType>
          </IncludeSchemaTypes>
          <xsd:element name="Priority">
            <xsd:simpleType>
              <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="0" />
                <xsd:maxInclusive value="2" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
          <xsd:element name="Severity">
            <xsd:simpleType>
              <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="0" />
                <xsd:maxInclusive value="2" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
          <xsd:element name="ManagedEntityId" type="xsd:string" />
          <xsd:element name="AlertName" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertDescription" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertOwner" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertMessageId" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertParameters" type="System.Health.AlertParameters" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Suppression" type="System.Health.Suppression" minOccurs="0" maxOccurs="1" />
          <xsd:element name="WorkflowId" type="xsd:string" />
          <xsd:element name="Custom1" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom2" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom3" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom4" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom5" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom6" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom7" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom8" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom9" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom10" type="xsd:string" minOccurs="0" maxOccurs="1" />
        </Configuration>
        <ModuleImplementation>
          <Native>
            <ClassID>2325018e-eef4-41a3-8c17-db831b85c93b</ClassID>
          </Native>
        </ModuleImplementation>
        <OutputType>Health!System.Health.AlertUpdateData</OutputType>
        <InputTypes>
          <InputType>System!System.BaseData</InputType>
        </InputTypes>
      </ConditionDetectionModuleType>
      <!-- publishes an alert to the database, internal -->
      <WriteActionModuleType ID="System.Connectors.PublishAlert" Accessibility="Internal">
        <Configuration />
        <ModuleImplementation>
          <Composite>
            <MemberModules>
              <WriteAction TypeID="System!System.PublishData" ID="WA">
                <ManagementGroupId>$Target/ManagementGroup/Id$</ManagementGroupId>
                <ChannelId>5BD75C47-95C4-4c33-99B4-BFF75A1C0764</ChannelId>
              </WriteAction>
            </MemberModules>
            <Composition>
              <Node ID="WA" />
            </Composition>
          </Composite>
        </ModuleImplementation>
        <InputType>Health!System.Health.AlertUpdateData</InputType>
      </WriteActionModuleType>
      <!-- Accepts an SCLibrary!Microsoft.SystemCenter.Event.LinkedData and generates an alert, public -->
      <WriteActionModuleType ID="System.Connectors.GenerateAlertFromSdkEvent" Accessibility="Public">
        <Configuration>
          <IncludeSchemaTypes>
            <SchemaType>Health!System.Health.AlertSchema</SchemaType>
          </IncludeSchemaTypes>
          <xsd:element name="Priority">
            <xsd:simpleType>
              <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="0" />
                <xsd:maxInclusive value="2" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
          <xsd:element name="Severity">
            <xsd:simpleType>
              <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="0" />
                <xsd:maxInclusive value="2" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
          <xsd:element name="AlertName" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertDescription" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertOwner" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertMessageId" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertParameters" type="System.Health.AlertParameters" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Suppression" type="System.Health.Suppression" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom1" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom2" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom3" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom4" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom5" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom6" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom7" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom8" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom9" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom10" type="xsd:string" minOccurs="0" maxOccurs="1" />
        </Configuration>
        <ModuleImplementation>
          <Composite>
            <MemberModules>
              <ConditionDetection TypeID="System.Connectors.GenericAlertMapper" ID="Mapper">
                <Priority>$Config/Priority$</Priority>
                <Severity>$Config/Severity$</Severity>
                <ManagedEntityId>$Data/ManagedEntityId$</ManagedEntityId>
                <AlertName>$Config/AlertName$</AlertName>
                <AlertDescription>$Config/AlertDescription$</AlertDescription>
                <AlertOwner>$Config/AlertOwner$</AlertOwner>
                <AlertMessageId>$Config/AlertMessageId$</AlertMessageId>
                <AlertParameters>$Config/AlertParameters$</AlertParameters>
                <Suppression>$Config/Suppression$</Suppression>
                <WorkflowId>$MPElement$</WorkflowId>
                <Custom1>$Config/Custom1$</Custom1>
                <Custom2>$Config/Custom2$</Custom2>
                <Custom3>$Config/Custom3$</Custom3>
                <Custom4>$Config/Custom4$</Custom4>
                <Custom5>$Config/Custom5$</Custom5>
                <Custom6>$Config/Custom6$</Custom6>
                <Custom7>$Config/Custom7$</Custom7>
                <Custom8>$Config/Custom8$</Custom8>
                <Custom9>$Config/Custom9$</Custom9>
                <Custom10>$Config/Custom10$</Custom10>
              </ConditionDetection>
              <WriteAction TypeID="System.Connectors.PublishAlert" ID="WA"></WriteAction>
            </MemberModules>
            <Composition>
              <Node ID="WA">
                <Node ID="Mapper" />
              </Node>
            </Composition>
          </Composite>
        </ModuleImplementation>
        <InputType>SCLibrary!Microsoft.SystemCenter.Event.LinkedData</InputType>
      </WriteActionModuleType>
      <!-- Accepts an SCLibrary!Microsoft.SystemCenter.Performance.LinkedData and generates an alert, public -->
      <WriteActionModuleType ID="System.Connectors.GenerateAlertFromSdkPerformanceData" Accessibility="Public">
        <Configuration>
          <IncludeSchemaTypes>
            <SchemaType>Health!System.Health.AlertSchema</SchemaType>
          </IncludeSchemaTypes>
          <xsd:element name="Priority">
            <xsd:simpleType>
              <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="0" />
                <xsd:maxInclusive value="2" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
          <xsd:element name="Severity">
            <xsd:simpleType>
              <xsd:restriction base="xsd:integer">
                <xsd:minInclusive value="0" />
                <xsd:maxInclusive value="2" />
              </xsd:restriction>
            </xsd:simpleType>
          </xsd:element>
          <xsd:element name="AlertName" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertDescription" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertOwner" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertMessageId" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="AlertParameters" type="System.Health.AlertParameters" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Suppression" type="System.Health.Suppression" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom1" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom2" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom3" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom4" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom5" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom6" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom7" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom8" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom9" type="xsd:string" minOccurs="0" maxOccurs="1" />
          <xsd:element name="Custom10" type="xsd:string" minOccurs="0" maxOccurs="1" />
        </Configuration>
        <ModuleImplementation>
          <Composite>
            <MemberModules>
              <ConditionDetection TypeID="System.Connectors.GenericAlertMapper" ID="Mapper">
                <Priority>$Config/Priority$</Priority>
                <Severity>$Config/Severity$</Severity>
                <ManagedEntityId>$Data/ManagedEntityId$</ManagedEntityId>
                <AlertName>$Config/AlertName$</AlertName>
                <AlertDescription>$Config/AlertDescription$</AlertDescription>
                <AlertOwner>$Config/AlertOwner$</AlertOwner>
                <AlertMessageId>$Config/AlertMessageId$</AlertMessageId>
                <AlertParameters>$Config/AlertParameters$</AlertParameters>
                <Suppression>$Config/Suppression$</Suppression>
                <WorkflowId>$MPElement$</WorkflowId>
                <Custom1>$Config/Custom1$</Custom1>
                <Custom2>$Config/Custom2$</Custom2>
                <Custom3>$Config/Custom3$</Custom3>
                <Custom4>$Config/Custom4$</Custom4>
                <Custom5>$Config/Custom5$</Custom5>
                <Custom6>$Config/Custom6$</Custom6>
                <Custom7>$Config/Custom7$</Custom7>
                <Custom8>$Config/Custom8$</Custom8>
                <Custom9>$Config/Custom9$</Custom9>
                <Custom10>$Config/Custom10$</Custom10>
              </ConditionDetection>
              <WriteAction TypeID="System.Connectors.PublishAlert" ID="WA"></WriteAction>
            </MemberModules>
            <Composition>
              <Node ID="WA">
                <Node ID="Mapper" />
              </Node>
            </Composition>
          </Composite>
        </ModuleImplementation>
        <InputType>SCLibrary!Microsoft.SystemCenter.Performance.LinkedData</InputType>
      </WriteActionModuleType>
    </ModuleTypes>
    <MonitorTypes>
      <!-- 2 state monitor for sdk example, for individually targeted instances, public -->
      <UnitMonitorType ID="System.Connectors.TwoStateMonitorType" Accessibility="Public">
        <MonitorTypeStates>
          <MonitorTypeState ID="RedEvent" />
          <MonitorTypeState ID="GreenEvent" />
        </MonitorTypeStates>
      <Configuration>
        <xsd:element name="RedEventId" type="xsd:int" minOccurs="1" maxOccurs="1"/>
        <xsd:element name="GreenEventId" type="xsd:int" minOccurs="1" maxOccurs="1"/>
      </Configuration>
        <MonitorImplementation>
          <MemberModules>
            <DataSource ID="DS" TypeID="SCLibrary!Microsoft.SystemCenter.TargetEntitySdkEventProvider" />
            <ConditionDetection TypeID="System!System.ExpressionFilter" ID="CDRedEvent">
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery>EventNumber</XPathQuery>
                  </ValueExpression>
                  <Operator>Equal</Operator>
                  <ValueExpression>
                    <Value>$Config/RedEventId$</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
            </ConditionDetection>
            <ConditionDetection TypeID="System!System.ExpressionFilter" ID="CDGreenEvent">
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery>EventNumber</XPathQuery>
                  </ValueExpression>
                  <Operator>Equal</Operator>
                  <ValueExpression>
                    <Value>$Config/GreenEventId$</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
            </ConditionDetection>
          </MemberModules>
          <RegularDetections>
            <RegularDetection MonitorTypeStateID="RedEvent">
              <Node ID="CDRedEvent">
                <Node ID="DS" />
              </Node>
            </RegularDetection>
            <RegularDetection MonitorTypeStateID="GreenEvent">
              <Node ID="CDGreenEvent">
                <Node ID="DS" />
              </Node>
            </RegularDetection>
          </RegularDetections>
        </MonitorImplementation>
      </UnitMonitorType>
    </MonitorTypes>
  </TypeDefinitions>
  <Monitoring>
    <Rules>
      <!-- Bulk alert processing from performance data -->
      <Rule ID="System.Connectors.Test.AlertOnThreshold" Enabled="true" Target="SCLibrary!Microsoft.SystemCenter.RootManagementServer" ConfirmDelivery="false">
        <Category>Alert</Category>
        <DataSources>
          <DataSource TypeID="SCLibrary!Microsoft.SystemCenter.SdkPerformanceDataProvider" ID="DataSource" />
        </DataSources>
        <ConditionDetection TypeID="System!System.ExpressionFilter" ID="ConditionDetection">
          <Expression>
            <SimpleExpression>
              <ValueExpression>
                <XPathQuery>Value</XPathQuery>
              </ValueExpression>
              <Operator>Greater</Operator>
              <ValueExpression>
                <Value>20</Value>
              </ValueExpression>
            </SimpleExpression>
          </Expression>
        </ConditionDetection>
        <WriteActions>
          <WriteAction TypeID="System.Connectors.GenerateAlertFromSdkPerformanceData" ID="WriteAction">
            <Priority>1</Priority>
            <Severity>1</Severity>
            <AlertName>Threshold exceeded for $Data/CounterName$ for bulk processing rule.</AlertName>
            <AlertDescription>The threshold of 20 was exceeded with a value of $Data/Value$ for object $Data/ObjectName$, counter $Data/CounterName$ and instance $Data/InstanceName$</AlertDescription>
            <AlertOwner>My Owner</AlertOwner>
          </WriteAction>
        </WriteActions>
      </Rule>
      <!-- Targeted alert creating from performance data -->
      <Rule ID="System.Connectors.Test.AlertOnThresholdForComputer" Enabled="true" Target="System!System.Computer" ConfirmDelivery="false">
        <Category>Alert</Category>
        <DataSources>
          <DataSource TypeID="SCLibrary!Microsoft.SystemCenter.TargetEntitySdkPerformanceDataProvider" ID="DataSource"/>
        </DataSources>
        <ConditionDetection TypeID="System!System.ExpressionFilter" ID="ConditionDetection">
          <Expression>
            <SimpleExpression>
              <ValueExpression>
                <XPathQuery>Value</XPathQuery>
              </ValueExpression>
              <Operator>Greater</Operator>
              <ValueExpression>
                <Value>20</Value>
              </ValueExpression>
            </SimpleExpression>
          </Expression>
        </ConditionDetection>
        <WriteActions>
          <WriteAction TypeID="Health!System.Health.GenerateAlert" ID="WriteAction">
            <Priority>1</Priority>
            <Severity>1</Severity>
            <AlertName>Threshold exceeded for $Data/CounterName$ for targeted processing rule</AlertName>
            <AlertDescription>The threshold of 20 was exceeded with a value of $Data/Value$ for object $Data/ObjectName$, counter $Data/CounterName$ and instance $Data/InstanceName$</AlertDescription>
            <AlertOwner>My Owner</AlertOwner>
          </WriteAction>
        </WriteActions>
      </Rule>
      <!-- Bulk alert processing from event -->
      <Rule ID="System.Connectors.Test.AlertOnEvent" Enabled="true" Target="SCLibrary!Microsoft.SystemCenter.RootManagementServer" ConfirmDelivery="false">
        <Category>Alert</Category>
        <DataSources>
          <DataSource TypeID="SCLibrary!Microsoft.SystemCenter.SdkEventProvider" ID="DataSource" />
        </DataSources>
        <ConditionDetection TypeID="System!System.ExpressionFilter" ID="ConditionDetection">
          <Expression>
            <SimpleExpression>
              <ValueExpression>
                <XPathQuery>EventNumber</XPathQuery>
              </ValueExpression>
              <Operator>Equal</Operator>
              <ValueExpression>
                <Value>1</Value>
              </ValueExpression>
            </SimpleExpression>
          </Expression>
        </ConditionDetection>
        <WriteActions>
          <WriteAction TypeID="System.Connectors.GenerateAlertFromSdkEvent" ID="WriteAction">
            <Priority>1</Priority>
            <Severity>1</Severity>
            <AlertName>Event triggered alert for instance $Data/ManagedEntityId$ for bulk processing rule</AlertName>
            <AlertDescription>The alert was triggered by event id $Data/EventNumber$ </AlertDescription>
            <AlertOwner>My Owner</AlertOwner>
          </WriteAction>
        </WriteActions>
      </Rule>
      <!-- Targeted alert creating from event -->
      <Rule ID="System.Connectors.Test.AlertOnEventForComputer" Enabled="true" Target="System!System.Computer" ConfirmDelivery="false">
        <Category>Alert</Category>
        <DataSources>
          <DataSource TypeID="SCLibrary!Microsoft.SystemCenter.TargetEntitySdkEventProvider" ID="DataSource"/>
        </DataSources>
        <ConditionDetection TypeID="System!System.ExpressionFilter" ID="ConditionDetection">
          <Expression>
            <SimpleExpression>
              <ValueExpression>
                <XPathQuery>EventNumber</XPathQuery>
              </ValueExpression>
              <Operator>Equal</Operator>
              <ValueExpression>
                <Value>1</Value>
              </ValueExpression>
            </SimpleExpression>
          </Expression>
        </ConditionDetection>
        <WriteActions>
          <WriteAction TypeID="Health!System.Health.GenerateAlert" ID="WriteAction">
            <Priority>1</Priority>
            <Severity>1</Severity>
            <AlertName>Event triggered alert for instance $Data/ManagedEntityId$ for targeted processing rule</AlertName>
            <AlertDescription>The alert was triggered by event id $Data/EventNumber$</AlertDescription>
            <AlertOwner>My Owner</AlertOwner>
          </WriteAction>
        </WriteActions>
      </Rule>
    </Rules>
    <Tasks>
    </Tasks>
    <Monitors>
      <!-- Targeted alert creating and state change from event -->
      <UnitMonitor ID="System.Connectors.Test.Monitor" Accessibility="Public" Target="System!System.Computer" Enabled="true" TypeID="System.Connectors.TwoStateMonitorType" ParentMonitorID="Health!System.Health.AvailabilityState">
        <Category>AvailabilityHealth</Category>
        <AlertSettings AlertMessage="System.Connectors.Test.Monitor.AlertMessage">
          <AlertOnState>Error</AlertOnState>
          <AutoResolve>true</AutoResolve>
          <AlertPriority>Low</AlertPriority>
          <AlertSeverity>Error</AlertSeverity>
          <AlertParameters>
            <AlertParameter1>$Data/Context/EventNumber$</AlertParameter1>
            <AlertParameter2>$Target/Id$</AlertParameter2>
          </AlertParameters>
        </AlertSettings>
        <OperationalStates>
          <OperationalState HealthState="Success" MonitorTypeStateID="GreenEvent" ID="Success" />
          <OperationalState HealthState="Error" MonitorTypeStateID="RedEvent" ID="Error" />
        </OperationalStates>
        <Configuration>
          <RedEventId>1</RedEventId>
          <GreenEventId>2</GreenEventId>
        </Configuration>
      </UnitMonitor>
    </Monitors>
  </Monitoring>
  <PresentationTypes>
    <UIPages>
    </UIPages>
  </PresentationTypes>
  <Presentation>
    <StringResources>
      <StringResource ID="System.Connectors.Test.Monitor.AlertMessage" />
    </StringResources>
  </Presentation>
  <LanguagePacks>
    <LanguagePack ID="ENU" IsDefault="true">
      <DisplayStrings>
        <DisplayString ElementID="System.Connectors.Library.Test">
          <Name>SDK Demo ManagementPack</Name>
          <Description>SDK Demo Library: This Management Pack contains definitions for the SDK/MCF functionality around inserting operational data.</Description>
        </DisplayString>
        <DisplayString ElementID="System.Connectors.Test.Monitor.AlertMessage">
          <Name>Demo Event Based Health</Name>
          <Description>The alert was genereted because event number {0} was inserted via the SDK for managed entity {1}.</Description>
        </DisplayString>
      </DisplayStrings>
      <KnowledgeArticles>
      </KnowledgeArticles>
    </LanguagePack>
  </LanguagePacks>
</ManagementPack>