none
je n'arrive à utiliser aucune variable de type $Target dans les règles ou monitors RRS feed

  • Question

  • Bonjour à tous,
    Je suis débutant et j'essaie de créer un Management pack pour superviser une application windows.

    J'ai créé une classe (Corporation.MyAppV2.MP.Application) et une discovery (Corporation.MyAppV2.MP.Application.Discovery) qui fonctionnent.
    J'ai ajouté une  property (Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path) à ma classe Corporation.MyAppV2.MP.Application.
    J'ai créé une  discovery (Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path.Discovery) pour cette property qui fonctionne également  : chaque instance de la classe Corporation.MyAppV2.MP.Application a sa propriété Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path property dans la console operation manager.

    Je veux maintenant utiliser cette propriété pour surveiller le fichier de log. J'ai donc créé une règle (Corporation.MyAppV2.TestRule.TextLog.Alert) et mis $Target/Property[Type="Corporation.MyAppV2.MP.Application"]/Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path$ dans logFileDirectory.
    Je ne peux enregistrer le management pack dans la console d'édition (authoring console), j'ai le message d'erreur ci-dessous.
    Il y a surement quelque chose qui m'échappe, je n'arrive à utiliser aucune variable de type $Target dans les règles ou monitors.
    Voici le message d'erreur et le fichier xml.

    Merci d'avance pour votre aide.

    Bruno

     

     

    Date: 07/12/2010 13:51:57
    Application: System Center Operations Manager 2007 Authoring Console
    Application Version: 6.0.6278.0
    Severity: Error
    Message: The management pack is corrupted and cannot be loaded.

    : Verification failed with [1] errors:
    -------------------------------------------------------
    Error 1:
    : Verification failed for rule: Corporation.MyAppV2.TestRule.TextLog.Alert

    Failed to verify referenced module : ID=AlertInvalid configuration specified for Module [Alert]Incorrect expression : '$Target/Property[Type="Corporation.MyAppV2.MP.Application"]/Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path' specified. Unable to resolve this expression. Please check this expression for errors. (Hints:  Check for correct character casing (upper case/lower case), mismatched "$" signs, double quotes("), square brackets "[" or "]" ). Here is a sample expression: $Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$
    -------------------------------------------------------

    <ManagementPack ContentReadable="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <Manifest>
      <Identity>
       <ID>Corporation.MyAppV2.MP</ID>
       <Version>1.0.0.0</Version>
      </Identity>
      <Name>Corporation.MyAppV2.MP</Name>
      <References>
       <Reference Alias="Windows">
        <ID>Microsoft.Windows.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
       </Reference>
       <Reference Alias="Performance">
        <ID>System.Performance.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
       </Reference>
       <Reference Alias="MicrosoftSystemCenterInstanceGroupLibrary6172210">
        <ID>Microsoft.SystemCenter.InstanceGroup.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
       </Reference>
       <Reference Alias="System">
        <ID>System.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
       </Reference>
       <Reference Alias="SC">
        <ID>Microsoft.SystemCenter.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
       </Reference>
       <Reference Alias="Health">
        <ID>System.Health.Library</ID>
        <Version>6.1.7221.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
       </Reference>
       <Reference Alias="AppLog">
        <ID>System.ApplicationLog.Library</ID>
        <Version>6.0.6278.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
       </Reference>
       <Reference Alias="SCDW">
        <ID>Microsoft.SystemCenter.DataWarehouse.Library</ID>
        <Version>6.0.6278.0</Version>
        <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
       </Reference>
      </References>
     </Manifest>
     <TypeDefinitions>
      <EntityTypes>
       <ClassTypes>
        <ClassType ID="Corporation.MyAppV2.MP.Application" Accessibility="Public" Abstract="false" Base="Windows!Microsoft.Windows.LocalApplication" Hosted="true" Singleton="false">
         <Property ID="Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path" Type="string" Key="false" CaseSensitive="false" Length="1024" MinLength="0" />
        </ClassType>
       </ClassTypes>
      </EntityTypes>
     </TypeDefinitions>
     <Monitoring>
      <Discoveries>
       <Discovery ID="Corporation.MyAppV2.MP.Application.Discovery" Enabled="true" Target="Windows!Microsoft.Windows.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal">
        <Category>Discovery</Category>
        <DiscoveryTypes />
        <DataSource ID="DS" TypeID="Windows!Microsoft.Windows.FilteredRegistryDiscoveryProvider">
         <ComputerName>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
         <RegistryAttributeDefinitions>
          <RegistryAttributeDefinition>
           <AttributeName>Exists.CorporationTomcatApps.Service</AttributeName>
           <Path>SYSTEM\CurrentControlSet\services\CorporationTomcatApps</Path>
           <PathType>0</PathType>
           <AttributeType>0</AttributeType>
          </RegistryAttributeDefinition>
         </RegistryAttributeDefinitions>
         <Frequency>3600</Frequency>
         <ClassId>$MPElement[Name="Corporation.MyAppV2.MP.Application"]$</ClassId>
         <InstanceSettings>
          <Settings>
           <Setting>
            <Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>
            <Value>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
           </Setting>
          </Settings>
         </InstanceSettings>
        </DataSource>
       </Discovery>
       <Discovery ID="Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path.Discovery" Enabled="true" Target="Corporation.MyAppV2.MP.Application" ConfirmDelivery="false" Remotable="true" Priority="High">
        <Category>Discovery</Category>
        <DiscoveryTypes>
         <DiscoveryClass TypeID="Corporation.MyAppV2.MP.Application">
          <Property TypeID="Corporation.MyAppV2.MP.Application" PropertyID="Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path" />
         </DiscoveryClass>
        </DiscoveryTypes>
        <DataSource ID="Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path.Discovery.DataSource" TypeID="Windows!Microsoft.Windows.FilteredRegistryDiscoveryProvider">
         <ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
         <RegistryAttributeDefinitions>
          <RegistryAttributeDefinition>
           <AttributeName>Wow6432Node.Exists</AttributeName>
           <Path>SOFTWARE\Wow6432Node</Path>
           <PathType>0</PathType>
           <AttributeType>0</AttributeType>
          </RegistryAttributeDefinition>
          <RegistryAttributeDefinition>
           <AttributeName>Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path.Discovery.DataSource</AttributeName>
           <Path>SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\CorporationTomcatSolr\Parameters\Log\Path</Path>
           <PathType>1</PathType>
           <AttributeType>1</AttributeType>
          </RegistryAttributeDefinition>
         </RegistryAttributeDefinitions>
         <Frequency>60</Frequency>
         <ClassId>$MPElement[Name="Corporation.MyAppV2.MP.Application"]$</ClassId>
         <InstanceSettings>
          <Settings>
           <Setting>
            <Name>$MPElement[Name="Corporation.MyAppV2.MP.Application"]/Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path$</Name>
            <Value>$Data/Values/Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path.Discovery.DataSource$</Value>
           </Setting>
           <Setting>
            <Name>$MPElement[Name="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Name>
            <Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</Value>
           </Setting>
          </Settings>
         </InstanceSettings>
         <Expression>
          <SimpleExpression>
           <ValueExpression>
            <XPathQuery Type="String">Values/Wow6432Node.Exists</XPathQuery>
           </ValueExpression>
           <Operator>Equal</Operator>
           <ValueExpression>
            <Value Type="String">true</Value>
           </ValueExpression>
          </SimpleExpression>
         </Expression>
        </DataSource>
       </Discovery>
      </Discoveries>
      <Rules>
       <Rule ID="Corporation.MyAppV2.TestRule.TextLog.Alert" Enabled="true" Target="Corporation.MyAppV2.MP.Application" ConfirmDelivery="false" Remotable="true" Priority="Normal" DiscardLevel="100">
        <Category>Custom</Category>
        <DataSources>
         <DataSource ID="LogDS" TypeID="AppLog!System.ApplicationLog.GenericLog.FilteredEventProvider">
          <LogFileDirectory>d:\test_bv</LogFileDirectory>
          <LogFilePattern>*.log</LogFilePattern>
          <LogIsUTF8>false</LogIsUTF8>
          <Expression>
           <RegExExpression>
            <ValueExpression>
             <XPathQuery Type="String">Params/Param[1]</XPathQuery>
            </ValueExpression>
            <Operator>ContainsSubstring</Operator>
            <Pattern>INFO</Pattern>
           </RegExExpression>
          </Expression>
         </DataSource>
        </DataSources>
        <WriteActions>
         <WriteAction ID="Alert" TypeID="Health!System.Health.GenerateAlert">
          <Priority>2</Priority>
          <Severity>2</Severity>
          <AlertName />
          <AlertDescription />
          <AlertOwner />
          <AlertMessageId>$MPElement[Name="Corporation.MyAppV2.TestRule.TextLog.Alert.AlertMessage"]$</AlertMessageId>
          <AlertParameters>
           <AlertParameter1>$Data/EventData/DataItem/LogFileDirectory$</AlertParameter1>
           <AlertParameter2>$Data/EventData/DataItem/LogFileName$</AlertParameter2>
           <AlertParameter3>$Data/EventData/DataItem/Params/Param[1]$</AlertParameter3>       
          </AlertParameters>
          <Suppression />
          <Custom1 />
          <Custom2 />
          <Custom3 />
          <Custom4 />
          <Custom5 />
          <Custom6 />
          <Custom7 />
          <Custom8 />
          <Custom9 />
          <Custom10 />
         </WriteAction>
        </WriteActions>
       </Rule>
      </Rules>
      <Monitors>
      </Monitors>
     </Monitoring>
     <Presentation>
      <Views>
      </Views>
      <Folders>
      </Folders>
      <FolderItems>
      </FolderItems>
      <StringResources>
       <StringResource ID="Corporation.MyAppV2.TestRule.TextLog.Alert.AlertMessage" />
      </StringResources>
     </Presentation>
     <LanguagePacks>
      <LanguagePack ID="FRA" IsDefault="false">
       <DisplayStrings>
        <DisplayString ElementID="Corporation.MyAppV2.MP">
         <Name>Corporation.MyAppV2.MP</Name>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.MP.Application">
         <Name>Corporation.MyAppV2.MP.Application</Name>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.MP.Application.Discovery">
         <Name>Corporation.MyAppV2.MP.Application Discovery</Name>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.TestsMonitors">
         <Name>Corporation.MyAppV2.TestsMonitors</Name>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.TestsMonitors.Alert">
         <Name>Corporation.MyAppV2.TestsMonitors.Alert</Name>
         <Description>testmonitors alert</Description>
        </DisplayString>
       </DisplayStrings>
      </LanguagePack>
      <LanguagePack ID="ENU" IsDefault="true">
       <DisplayStrings>
        <DisplayString ElementID="Corporation.MyAppV2.MP">
         <Name>Corporation.MyAppV2.MP</Name>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.MP.Application">
         <Name>Corporation.MyAppV2.MP.Application</Name>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.MP.Application.Discovery">
         <Name>Corporation.MyAppV2.MP.Application Discovery</Name>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.TestsMonitors">
         <Name>Corporation.MyAppV2.TestsMonitors</Name>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.TestsMonitors.Alert">
         <Name>Corporation.MyAppV2.TestsMonitors</Name>
         <Description>testmonitors alert</Description>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.TestRule.TextLog.Alert">
         <Name>Corporation.MyAppV2.TestRule.TextLog.Alert</Name>
         <Description>Corporation.MyAppV2.TestRule.TextLog.Alert</Description>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.TestRule.TextLog.Alert.AlertMessage">
         <Name>Alerte bleue</Name>
         <Description>Logfile Directory : {0} 
    Logfile name: {1} 
    String: {2}</Description>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.MP.Application" SubElementID="Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path">
         <Name>Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path</Name>
        </DisplayString>
        <DisplayString ElementID="Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path.Discovery">
         <Name>Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path.Discovery</Name>
         <Description>Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path.Discovery</Description>
        </DisplayString>
       </DisplayStrings>
      </LanguagePack>
     </LanguagePacks>
    </ManagementPack>
    • Modifié Bruno_V mardi 7 décembre 2010 14:51 mise en forme et traduction française
    mardi 7 décembre 2010 13:33

Réponses

  • Voici l'origine du problème : les propriétés contenaient des points.

    J'ai remplacé Corporation.MyAppV2.Application.CorporationTomcatSolr.Parameters.Log.Path par TomcatSolrLogPath et ça marche.

    Bruno

     

    • Marqué comme réponse Bruno_V mercredi 8 décembre 2010 08:56
    mercredi 8 décembre 2010 08:56