.NET Agent for Linux のインストール

はじめに

開始する前に、次の前提条件を確認します。

  1. 互換性のあるコントローラへのアクセス権を持っていることを確認します。「」「 エージェントとコントローラテナントの互換性」を参照してください。
  2. エージェントがデータをレポートするコントローラへの接続設定を確認します。
    • SaaS コントローラを使用する場合、Splunk AppDynamics によるウェルカムメールでコントローラのホストが送信されます。HTTPSにはポート443を使用し、HTTPにはポート80を使用します。
    • オンプレミスコントローラを使用する場合、インストール時にホストとポートを指定しています。
  3. アプリケーションが実行されているマシンに、エージェントソフトウェアのインストール権限を持つユーザーアカウントとしてアクセスできることを確認し、アプリケーションを再起動します。
  4. アプリケーションを実行するマシンがコントローラに接続できることを確認します。エージェントとコントローラ間のネットワークのプロキシまたはファイアウォールに対して、追加の構成が必要になる場合があります。
  5. エージェントの実行前に、アプリケーション環境が要件を満たしていることを確認します。「.NET 対応環境」を参照してください。

アプリケーションとライセンスの概要

次のアプリケーションとライセンスを持っていることを確認してください。

  • Linux 上で実行されている.NET Core アプリケーション。
  • Linux 上で実行されている .NET Core アプリケーションごとの .NET ライセンス「ライセンス使用状況の確認」を参照してください。

バイナリの概要

Splunk AppDynamicsダウンロードサイトからエージェントのバイナリをダウンロードし、zip ファイルから目的のフォルダに展開します。

アーカイブには次のファイルが含まれています。

  • AppDynamics.Agent.netstandard.dll
  • libappdprofiler_arm64.so
  • libappdprofiler_glibc_arm64.so
  • libappdprofiler_musl_arm64.so
  • README.md
注: zip ファイルから 4 つのエージェントバイナリをすべて展開する必要があります。

Deployment

There are two options for starting your deployment using Docker:

Create Your Own Image

You can use the ASP.NET sample application from Microsoft and a Dockerfile to build your own image, and get started:

  1. Use a multistage build with appdynamics/dotnet-core-agent:latest to get agent binaries.
  2. Update the Dockerfile variables to configure the connection to the Controller and your application identity in AppDynamics.
  3. Create the Docker image.

The following is an example Dockerfile with commented instructions:

JSON
FROM mcr.microsoft.com/dotnet/core/samples:aspnetapp
####### Requirements
# Have the following files alongside the Dockerfile:
# * libappdprofiler_arm64.so
# * AppDynamics.Agent.netstandard.dll
####### Instructions
# Building image: docker build --rm -t appdynamicstest:latest .
# Running container: docker run --rm -p 8000:80 appdynamicstest:latest
# Open the application using http://localhost:8000/
#######

FROM appdynamics/dotnet
ADD libappdprofiler_arm64.so /opt/appdynamics-core-agent:latest AS appd

FROM mcr.microsoft.com/dotnet/
ADD libappdprofiler_glibc_arm64.sosamples:aspnetapp
COPY --from=appd /opt/appdynamics /dotnet/
ADD libappdprofiler_musl_arm64.so /opt/appdynamics/dotnet

# Mandatory settings required to attach the agent to the .NET application
ENV CORECLR_PROFILER={57e1aa68-2229-41aa-9931-a6e93bbc64d8} \
    CORECLR_ENABLE_PROFILING=1 \
CORECLR_PROFILER_PATH_ARM64
    CORECLR_PROFILER_PATH_ARM64=/opt/appdynamics/dotnet/libappdprofiler_arm64.so \
    CORECLR_PROFILER_PATH=/opt/appdynamics/dotnet/libappdprofiler.so

# Configure connection to the controller
ENV APPDYNAMICS_CONTROLLER_HOST_NAME=controller.saas.appdynamics.com
ENV APPDYNAMICS_CONTROLLER_PORT=443
ENV APPDYNAMICS_CONTROLLER_SSL_ENABLED=true
ENV APPDYNAMICS_AGENT_ACCOUNT_NAME=account-name
ENV APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY=access-key

# Configure application identity in AppDynamics
ENV APPDYNAMICS_AGENT_APPLICATION_NAME="My Application"
ENV APPDYNAMICS_AGENT_TIER_NAME="Sample Tier"
ENV APPDYNAMICS_AGENT_NODE_NAME="MyNode"

# It is possible to configure .NET agent using AppDynamicsConfig.json configuration file instead of environment variables.
# To do so, rename AppDynamicsConfig.json.template to AppDynamicsConfig.json and update values in the file.
# ADD AppDynamicsConfig.json /opt/appdynamics/dotnet/

Run an Existing Image

To quickly deploy an existing Docker image with an agent enabled without building a new image, follow these steps:

  1. Download the agent binaries. Ensure that the archive matches the target CPU architecture (amd64 or arm64).
  2. Update the Docker command variables to configure the connection to the Controller and your application identity in AppDynamics..
  3. Execute the Docker command from the directory where you extracted the agent binaries. You can replace $(pwd) in the command with the path to this directory.

This example runs the sample application. It assumes you have Splunk AppDynamics binaries in the current directory (which contains the extracted agent archive):

Example command to run existing image with .NET agent enabled:
JSON
docker run \
-p 8000:80 \
-e CORECLR_PROFILER={57e1aa68-2229-41aa-9931-a6e93bbc64d8} \
-e CORECLR_ENABLE_PROFILING=1 \
-e CORECLR_PROFILER_PATH_ARM64=/opt/appdynamics/dotnet/libappdprofiler.so \
-e CORECLR_PROFILER_PATH_ARM64=/opt/appdynamics/dotnet/libappdprofiler_arm64.so \
-e APPDYNAMICS_CONTROLLER_HOST_NAME=controller.saas.appdynamics.com \
-e APPDYNAMICS_CONTROLLER_PORT=443 \
-e APPDYNAMICS_CONTROLLER_SSL_ENABLED=true \
-e APPDYNAMICS_AGENT_ACCOUNT_NAME=account-name \
-e APPDYNAMICS_AGENT_ACCOUNT_ACCESS_KEY=access-key \
-e APPDYNAMICS_AGENT_APPLICATION_NAME="My Application" \
-e APPDYNAMICS_AGENT_TIER_NAME="Sample Tier" \
-e APPDYNAMICS_AGENT_NODE_NAME="MyNode" \
-v "$(pwd)":/opt/appdynamics/dotnet/ \
mcr.microsoft.com/dotnet/core/samples:aspnetapp

The command mounts agent files as a volume and sets environment variables required for the agent to attach.

起動フロー

アプリケーションの起動時に、エージェントによってメッセージがコンソールおよびアプリケーションと .NET フレームワークに書き込まれます。

この .NET エージェント起動コンソール出力は、適切なエージェントの初期化を示しています。

CODE
appd.agent.profiler(Info): ...

.NET Agent for Linux のトラブルシューティング」を参照してください。