Windowsサービスとスタンドアロンアプリケーションの.NETエージェントの構成

.NET エージェントは、IIS アプリケーションのみを自動的にインストゥルメント化します。ただし、以下の手順に従って、Windows サービスやスタンドアロン .NET アプリケーションをインストゥルメント化するように .NET エージェントを手動で構成できます。

Web アプリケーションが処理中のハンドラとして実行するように設定されていない場合、アプリケーションは または として実行することがあります。

はじめる前に

Windows サービスとスタンドアロン .NET アプリケーションをインストゥルメント化するには、.NET エージェント構成ファイル config.xml を編集します。

注: デフォルトドメインを使用してアプリケーションを実行する場合、手動でインストゥルメント化する必要があります。Splunk AppDynamics では、初期設定ではデフォルトのドメインを自動的にはインストゥルメント化しません。デフォルトドメインを使用する必要があるかどうか、およびその構成方法を判断するには、「スタンドアロンアプリケーションのDefaultDomainのインストルメンテーション」を参照してください。

開始する前に、インストゥルメント化するサービスまたはアプリケーションがネイティブアプリケーションや別のタイプのアプリケーションではなく、.NETアプリケーションであることを確認します。コマンドラインから次のように入力します。

tasklist /m "mscor*"
警告: このコマンドは、64 ビットプロセス専用です。32 ビットプロセスの場合は、Process Explorer を使用して、プロセスの依存関係と、ファイルにロードされた .NET .dll ファイルがあるかどうかを確認します。

出力には、mscor * で始まる dll を使用しているプロセスがリストされます。

Windows サービスとスタンドアロン アプリケーションをホストするサーバーで、以前 IIS アプリケーションのインストゥルメント化を行っている場合、サーバーにはすでに config.xml ファイルがあるはずです。

  1. Windows 用 .NET エージェントのインストール
  2. Splunk AppDynamicsエージェント構成ユーティリティを実行します。

IIS アプリケーションをインストゥルメント化しない場合は、階層の手動命名方式を選択して、IIS アプリケーションの階層を割り当てる手順を省略します。これにより IIS アプリケーションのインストルメンテーションが無効化され、対象の Windows サービスまたはスタンドアロン アプリケーションのみをインストゥルメント化できるようになります。

ユーティリティにより次の構成タスクが実行されます。

  1. ログディレクトリの場所を変更し、権限を割り当てます。
  2. コントローラへの接続を構成およびテストします。
  3. エージェント用ビジネスアプリケーションを設定します。

Manually Configure the .NET Agent

Once you have configured the Controller properties for the .NET Agent, instrument your Windows service or standalone application by adding the Standalone Applications element to the config.xml

  1. Edit the config.xml as an administrator, see Administer the .NET Agent.

    If you have not instrumented any IIS applications, the file contains the minimal configuration for the Controller connectivity and the Machine Agent. Verify the Controller properties and the Business Application name (shown in this example):

    <?xml version="1.0" encoding="utf-8"?>
    <appdynamics-agent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <controller host="mycontroller.example.com" port="8090" ssl="false">
    <application name="My Business Application" />
    </controller>
    ...
    </appdynamics-agent>

    If you have already instrumented IIS applications, those configurations display under the IIS element

  2. Add a single standalone applications element, standalone-applications under the app-agents element, and under the standalone-applications element, add a standalone application element, standalone-application for each Windows service or standalone application to instrument. For example:
    ...
    <app-agents>
    ...
    <standalone-applications>
    <standalone-application executable="MyStandaloneApp.exe">
    <tier name="Standalone Tier 1" />
    </standalone-application>
    <!-- Instrument a standalone application using a partial path. -->
    <standalone-application executable="MyApplication\MyOtherStandaloneApp.exe">
    <tier name="Standalone Tier 2" />
    </standalone-application>
    <!-- Instrument a Windows service using arguments. -->
    <!-- The following example matches the command "MyWindowsService.exe -d -x -r". -->
    <standalone-application executable="MyWindowsService.exe" command-line="-x">
    <tier name="Windows Service Tier" />
    </standalone-application>
    </standalone-applications>
    </app-agents>
    ...

    In the standalone application element configuration:

    • Use the tier .NET Agent Configuration Properties.

    • Identify the executable file of the application in the Standalone Application element executable

      • Executable name: For example, MyStandaloneApp.exe MyWindowsService.exe MyStandaloneApp dotnet.exe "dotnet.exe"

      • Full or partial path to the executable: For example, C:\Program Files\MyApplication\MyStandaloneApp.exe MyApplication\MyStandaloneApp.exe

      • To differentiate between two instances of the same executable, specify any unique portion of the command line invocation format of the application, such as an argument, in the Standalone Application command-line attribute.

      ヒント: You can discover the path to a Windows service executable in the Services panel of the administrative tools. In Services, click the service and select Properties. The path display in the General tab.
  3. Restart the AppDynamics.Agent.Coordinator
  4. Restart the Windows service or standalone application.
  5. If your Windows service or standalone application does not implement an auto-detected framework, you must configure a POCO entry point for a class or method in your service for the agent to begin instrumentation.

構成ファイルのサンプル

次の config.xml 例は、Windows サービスおよびスタンドアロン アプリケーションのインストルメンテーションを示しています。

<?xml version="1.0" encoding="utf-8"?>
<appdynamics-agent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<controller host="mycontroller.mycompany.com" port="8090" ssl="false">
<application name="My Business Application" />
</controller>
<machine-agent />
<app-agents>
<IIS>
<applications />
</IIS>
<standalone-applications>
<standalone-application executable="MyWindowsService.exe" command-line="-x">
<tier name="Windows Service Tier" />
</standalone-application>
<standalone-application executable="MyStandaloneApp.exe">
<tier name="Standalone Tier" />
</standalone-application>
</standalone-applications>
</app-agents>
</appdynamics-agent>

.NET Core アプリケーションが実行可能ファイルとしてパブリッシュされている場合は、実行可能ファイル名とコマンドライン(オプション)を指定することによって、.NET Framework アプリケーションと同様に設定できます。ただし、アプリケーションがライブラリとしてパブリッシュされている場合は、dotnet.exe ツールを呼び出すことによって開始されます。

次の設定例は、dotnet.exe によってホストされている .NET Core スタンドアロン アプリケーションをインストゥルメント化する方法を示しています。

<?xml version="1.0" encoding="utf-8"?>
<appdynamics-agent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<controller host="mycontroller.mycompany.com" port="8090" ssl="false">
<application name="My Business Application" />
</controller>
<machine-agent />
<app-agents>
<IIS>
<applications />
</IIS>
<standalone-applications>
<standalone-application executable="dotnet.exe" command-line="MyApp.dll"> //command-line option instructs the agent to monitor only "MyApp"
<tier name="DotNet Core Tier" />
</standalone-application>
</standalone-applications>
</app-agents>
</appdynamics-agent>

トラブルシューティング

断続的な Windows サービスのインストルメンテーションの消失

Windows サービスをインストゥルメント化するときに、インストゥルメント化されたサービスが AppDynamics.Agent.Coordinator の前に初期化される場合があります。

次の手順では、Windows 2008 および Windows 2012 以降でこの問題を解決する方法について説明します。

Windows 2008

Windows 2008

Windows 2008 を使用している場合は、AppDynamics サポートにお問い合わせください。

Windows 2012 以降

Windows 2012 以降

インストゥルメント化された Windows サービスの前に AppDynamics.Agent.Coordinator サービスが初期化されるようにするには、レジストリを変更する必要があります。レジストリキー @HKLM:\SYSTEM\CurrentControlSet\Control\EarlyStartServices(早期開始サービスのリスト)で、AppDynamics.Agent.Coordinator_service を追加します。