次の方法で共有


Linux ログ ファイル管理パックのサンプル

注記

System Center Operations Manager は、2024 年 8 月に予定されている OMS エージェントの提供終了時に fluentD ベースのログ ファイルの監視をサポートしません。

これは System Center Operations Manager で Linux のログ ファイルからアラートを作成するためのサンプル管理パックです。 コンテンツをコピーして XML ファイルに貼り付け、Operations Manager 管理グループにインストールできます。

この管理パックは、収集されたすべてのイベントのアラートを作成します。 管理パックのコメントには、特定のイベント番号を持つイベントのアラートのみを作成する別のルールがあります。 このルールを使用するには、コメントを削除し、イベント番号を必要な番号に置き換えます。

  <ManagementPack>
      <Manifest>
          <Identity>
          <ID>OMEDEvent</ID>
          <Version>1.0.0.1</Version>
          </Identity>
          <Name>OMEDEvent</Name>
          <References>
              <Reference Alias="Health">
                  <ID>System.Health.Library</ID>
                  <Version>7.0.8437.0</Version>
                  <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
              </Reference>
              <Reference Alias="SystemCenter">
                  <ID>Microsoft.SystemCenter.Library</ID>
                  <Version>7.0.8437.0</Version>
                  <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
              </Reference>
              <Reference Alias="Windows">
                  <ID>Microsoft.Windows.Library</ID>
                  <Version>7.5.8501.0</Version>
                  <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
              </Reference>
              <Reference Alias="System">
                  <ID>System.Library</ID>
                  <Version>7.5.8501.0</Version>
                  <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
              </Reference>
              <Reference Alias="Unix">
                  <ID>Microsoft.Unix.Library</ID>
                  <Version>7.4.4515.0</Version>
                  <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
              </Reference>
              <Reference Alias="Linux">
                  <ID>Microsoft.Linux.Library</ID>
                  <Version>7.6.1081.0</Version>
                  <PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
              </Reference>
          </References>
      </Manifest>
      <Monitoring>
          <!--This rule looks for all the events from the datasource OMED.EventDataSource and would generate an Alert in SCOM.  -->
          <Rules>
              <Rule ID="RuleForAllEvents" Enabled="true" Target="Linux!Microsoft.Linux.Computer" >
                  <Category>EventCollection</Category>
                  <DataSources>
                      <!-- check data source id -->
                      <DataSource TypeID="Linux!Microsoft.Linux.OMED.EventDataSource" ID="Rule0DS0">
                          <ComputerName>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</ComputerName>
                          <ManagedEntityId>$Target/Id$</ManagedEntityId>
                      </DataSource>
                  </DataSources>
                  <WriteActions>
                      <WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
                          <!-- Alert Priority and Severity is set to 2, this is configurable -->
                          <Priority>2</Priority>
                          <Severity>2</Severity>

                          <!--Alert description would be the event description. This description and the event ID are defined in the fluentd configuration
                          file by the user for log file monitoring.-->

                          <AlertMessageId>$MPElement[Name="EventProvider.Alert"]$</AlertMessageId>
                          <AlertParameters>
              <AlertParameter1>$Data/EventDescription$</AlertParameter1>
                          </AlertParameters>
                          <Suppression />

                          </WriteAction>
                  </WriteActions>
              </Rule>
              <!-- Below is a sample MP Rule that could be used, if the user wants to add a rule to look for any specific event and generate alert -->
              <!--
              <Rule ID="RuleForEvent404" Enabled="true" Target="Windows!Microsoft.Windows.Computer" >
                  <Category>EventCollection</Category>
                  <DataSources>
                      <DataSource TypeID="Linux!Microsoft.Linux.OMED.EventDataSource" ID="Rule1DS0">  
                          <ComputerName>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</ComputerName>
                          <ManagedEntityId>$Target/Id$</ManagedEntityId>
                          <EventNumber>404</EventNumber>
                      </DataSource>
                  </DataSources>
                  <WriteActions>
                      <WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
                          <Priority>2</Priority>
                          <Severity>2</Severity>
                          <AlertMessageId>$MPElement[Name="EventProvider.Alert"]$</AlertMessageId>
                          <AlertParameters>
                              <AlertParameter1>$Data/EventDescription$</AlertParameter1>
                          </AlertParameters>
                          <Suppression />
                      </WriteAction>
                  </WriteActions>
              </Rule>
              -->
          </Rules>
      </Monitoring>
      <Presentation>
          <StringResources>
              <StringResource ID="EventProvider.Alert" />
          </StringResources>
      </Presentation>
      <LanguagePacks>
          <LanguagePack ID="ENU" IsDefault="true">
              <DisplayStrings>
                  <DisplayString ElementID="EventProvider.Alert">
                      <Name> Event Provider Alert</Name>
                      <Description>{0}</Description>
                  </DisplayString>
              </DisplayStrings>
          </LanguagePack>
      </LanguagePacks>
  </ManagementPack>

次のステップ

ログを収集する Fluentd 構成ファイルを作成するには、Linux ログ ファイルを収集するための サンプル構成ファイルを参照してください。