Javaエージェント設定にシステムプロパテイを使用する
Javaエージェントは、システムプロパティとして指定された構成設定を受け入れることができます。これは、マシン上で複数のJVMが実行されており、ノードプロパティを動的に設定する必要がある場合に便利です。
Splunk AppDynamics モデルでは、JVM が同じティアにある場合と異なるティアにある場合があります。いずれの場合も、次のようになります。
- すべての共通の情報は次のファイルを使用して構成します。
controller-info.xml - JVM に固有のすべての情報は、スタートアップスクリプトのシステムプロパティ(
-Dオプション)を使用して構成します。 - 起動スクリプトの情報は常に
controller-info.xmlファイルの情報をオーバーライドします。
Javaエージェント構成プロパティでは、Java エージェントで利用可能なシステムプロパティについて説明します。JavaエージェントのインストールJavaエージェントのインストール
Reference System Properties
You can reference system properties from the command line, or in the agent configuration file to specify the node name, tier name, or other agent configuration properties dynamically.
For example, consider a Java application started with a script named
startserver.sh. The script defines a system property as:
-Dserver.name=$1
The property server.name will get the value of the first argument passed
when starting the script. For example, the following command to start the JVM would bind the
server.name property to the value ecommerce01:
startserver.sh ecommerce01
You can use this value in your agent configuration by setting the
-Dappdynamics.agent.nodeName property at startup:
-Dappdynamics.agent.nodeName=$server.name
Or, you can use the value in the controller-info.xml file, using this
format:
${system_property_name}
For example:
<controller-info>
...
<node-name>${server.name}</node-name>
</controller-info>
Note that server.name is the name of a sample system property used here to
identify the node. Use an appropriate system property that is available in your environment
for the Java Agent node name.
To have tier names assigned dynamically, supply a dynamic value to the tier name property:
java -javaagent:<agent_home>/javaagent.jar -Dappdynamics.agent.tierName=$tierName -Dappdynamics.agent.nodeName=$nodeName
Combine Properties
You can combine multiple system properties to name nodes or tiers. For example, in
controller-info.xml, combine properties as:
${system_property_name_1}${system_property_name_2}
You can combine system properties with literals. In the following example "_" and "inventory" are literals.
${myhost.name}_${myserver.name}.inventory
You can use existing system properties for the Controller host and port settings as well; however, combining properties as shown here is not supported for those settings.