The Java Agent can accept configuration settings specified as system properties. This is useful when you have more than one JVM running on a machine and need to set node properties dynamically.
The JVMs may be in the same tier, or on different tiers in the AppDynamics model. In either case:
- All common information should be configured using
- All information unique to a JVM should be configured using the system properties (
-Doption) in the startup script.
- Information in the startup scripts always overrides the information in the
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:
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
You can use this value in your agent configuration by setting the
-Dappdynamics.agent.nodeName property at startup:
Or, you can use the value in the
controller-info.xml file, using this format:
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:
You can combine multiple system properties to name nodes or tiers. For example, in
controller-info.xml, combine properties as:
You can combine system properties with literals. In the following example "_" and "inventory" are literals.
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.