﻿<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>SampleDiscoveryDataMP</ID>
      <Version>1.0.0.0</Version>
    </Identity>
    <Name>Sample Discovery Data Management Pack</Name>
    <References>
      <Reference Alias="System">
        <ID>System.Library</ID>
        <Version>6.0.5000.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
      <Reference Alias="MapperLibrary">
        <ID>Microsoft.SystemCenter.ClientMonitoring.Library</ID>
        <Version>6.0.5000.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
      </Reference>
    </References>
  </Manifest>
  <TypeDefinitions>
    <EntityTypes>
      <ClassTypes>
        <ClassType ID="MyAgent" Accessibility="Public" Base="System!System.Entity" Hosted="false" Abstract="false">
          <Property ID="AgentID" Type="int" Key="true" />
          <Property ID="AgentName" Type="string" Key="false" CaseSensitive="false" />
          <Property ID="AgentVersion" Type="string" Key="false" CaseSensitive="false" />
          <Property ID="AgentOwner" Type="string" Key="false" CaseSensitive="false" />
          <Property ID="LastMessageReceived" Type="string" Key="false" CaseSensitive="false" />
          <Property ID="Comments" Type="string" Key="false" CaseSensitive="false" />
        </ClassType>
      </ClassTypes>
      <RelationshipTypes />
    </EntityTypes>
    <DataTypes>
      <DataType ID="AgentData" Base="System!System.BaseData" Accessibility="Public">
        <Implementation>
          <Assembly>ServerAssembly</Assembly>
          <Type>ServerNamespace.AgentData</Type>
        </Implementation>
      </DataType>
    </DataTypes>
    <ModuleTypes>
      <DataSourceModuleType ID="AgentExplorer" Accessibility="Public">
        <Configuration />
        <ModuleImplementation>
          <Managed>
            <Assembly>ServerAssembly</Assembly>
            <Type>ServerNamespace.MyServer</Type>
          </Managed>
        </ModuleImplementation>
        <OutputType>AgentData</OutputType>
      </DataSourceModuleType>
      <DataSourceModuleType ID="AgentDataGenerator" Accessibility="Public">
        <Configuration />
        <ModuleImplementation>
          <Composite>
            <MemberModules>
              <DataSource ID="AgentExplorerDS" TypeID="AgentExplorer" />
              <ProbeAction ID="DiscoveryMapper" TypeID="MapperLibrary!Microsoft.SystemCenter.CM.DiscoveryMapperPA">
                <ManagedEntity>
                  <Detailed>
                    <TimeGenerated UseCurrent="true" />
                    <DiscoveryType>AddUpdate</DiscoveryType>
                    <DiscoverySourceType>Rule</DiscoverySourceType>
                    <SourceObjectId>$MPElement$</SourceObjectId>
                    <SourceManagedEntityId>$Target/Id$</SourceManagedEntityId>
                    <Properties>
                      <Evaluate If=".">
                        <Property ID="IDValue">//AgentData/ID</Property>
                        <Property ID="NameValue">//AgentData/Name</Property>
                        <Property ID="VersionValue">concat(//AgentData/MajorVersion, “.”, //AgentData/MinorVersion)</Property>
                        <Property ID="OwnerValue">//AgentData/OwnerInfo/Name</Property>
                        <Property ID="MessageValue">//AgentData/Message</Property>
                      </Evaluate>
                    </Properties>
                    <PropertySets />
                    <ClassInstances>
                      <ClassInstance If=".">
                        <TypeId>$MPElement[Name="MyAgent"]$</TypeId>
                        <Properties>
                          <Property>
                            <Name>$MPElement[Name="MyAgent"]/AgentID$</Name>
                            <Value>IDValue</Value>
                          </Property>
                          <Property>
                            <Name>$MPElement[Name="MyAgent"]/AgentName$</Name>
                            <Value>NameValue</Value>
                          </Property>
                          <Property>
                            <Name>$MPElement[Name="MyAgent"]/AgentVersion$</Name>
                            <Value>VersionValue</Value>
                          </Property>
                          <Property>
                            <Name>$MPElement[Name="MyAgent"]/AgentOwner$</Name>
                            <Value>OwnerValue[0]</Value>
                          </Property>
                          <Property>
                            <Name>$MPElement[Name="MyAgent"]/LastMessageReceived$</Name>
                            <Value>MessageValue</Value>
                          </Property>
                          <Property Optional="true">
                            <Name>$MPElement[Name="MyAgent"]/Comments$</Name>
                            <Value>No Comments!</Value>
                          </Property>
                        </Properties>
                      </ClassInstance>
                    </ClassInstances>
                    <RelationshipInstances />
                  </Detailed>
                </ManagedEntity>
              </ProbeAction>
            </MemberModules>
            <Composition>
              <Node ID="DiscoveryMapper">
                <Node ID="AgentExplorerDS" />
              </Node>
            </Composition>
          </Composite>
        </ModuleImplementation>
        <OutputType>System!System.Discovery.Data</OutputType>
      </DataSourceModuleType>
    </ModuleTypes>
  </TypeDefinitions>
  <Monitoring>
    <Discoveries>
      <Discovery ID="AgentDiscoverer" Target="System!System.Computer" Enabled="true" ConfirmDelivery="true">
        <Category>Discovery</Category>
        <DiscoveryTypes>
          <DiscoveryClass TypeID="MyAgent" />
        </DiscoveryTypes>
        <DataSource ID="AgentDiscovererDS" TypeID="AgentDataGenerator" />
      </Discovery>
    </Discoveries>
  </Monitoring>
  <LanguagePacks>
    <LanguagePack ID="ENU" IsDefault="true">
      <DisplayStrings>
        <!-- MP NAME -->
        <DisplayString ElementID="SampleDiscoveryDataMP">
          <Name>Sample MP creating/submitting Discovery Data</Name>
          <Description>Sample Discovery Data MP: This Management Pack contains examples showing how to use managed discovery data mapper module to generate discovery data out of any other data type.</Description>
        </DisplayString>
        <!-- CLASS TYPES -->
        <DisplayString ElementID="MyAgent">
          <Name>My Agent</Name>
          <Description>Information about agents that contact my server.</Description>
        </DisplayString>
        <!-- DATA TYPES -->
        <DisplayString ElementID="AgentData">
          <Name>Agent Data Type</Name>
          <Description>This is information outputted by my server module about various agents it knows about.</Description>
        </DisplayString>
        <!-- MODULES -->
        <DisplayString ElementID="AgentExplorer">
          <Name>Server: Agent Explorer Module</Name>
          <Description>This data-source module generates agent data.</Description>
        </DisplayString>
      </DisplayStrings>
    </LanguagePack>
  </LanguagePacks>
</ManagementPack>


