Download PDF
Download page Auto-Attach Agents to Applications.
Auto-Attach Agents to Applications
Smart Agent provides the auto-attach feature to auto instrument a Java application with Java Agent or a NodeJS application with the Node.js Agent. This feature is used to detect and start the supported Splunk AppDynamics agents without modifying the start configuration of the applications. You can use Smart Agent Command Line Utility for additional configuration.
Supported Runtimes and Frameworks:
- Java: Tomcat, Weblogic, Springboot, JBoss, Glassfish and plain Java applications
- NodeJS
Customize Auto-Attach Configuration
You can overwrite the default ld_preload.json
(attaches the agent to all supported Java frameworks and NodeJS applications) and add your own with your updated rules.
The default location for ld_preload.json
is <SmartAgent directory>/lib/ld_preload.json
.
The default auto-attach path is the same as the agent path, which is defined at the root level.
If you are using any custom agent paths, ensure that it is specified in the ld_preload.json
file.
For Java Agent, you can specify the required agent path for each regex within the ld_preload.json
file. This allows specific Java Agent to auto-attach to a specific Java service.
To use advanced auto-attach configuration or configure auto-attach on multiple hosts in an automated way, you can use Smart Agent Command Line Utility.
You can update the ld_preload.json
file based on the following scenarios:
Scenario | Update to ld_preload.json |
---|---|
To disable auto-attach feature for any of the Java processes. |
JSON
|
To ignore the Java processes that are pre-configured using the custom path. But, use the Java Agent custom path to auto-attach any non-instrumented Java processes. |
JSON
Here, |
To auto-generate the application, tier, and node names. |
CODE
Here, The following are the variable values that change based on the environment variable that you specify:
|
Filters
The JSON configuration is broken into sections per supported runtime. For example, Java, NodeJS. For each section, you can provide a set of filters using regular expressions and also define a filter to auto attach or ignore the discovered application(s). The filters are applied in an order. The regular expressions are applied to the entire command line.
Example regex:
{
"name": "instrument node applications",
"regex": "node .*\\.js.*$",
"instrument": true
},
{
"name": "ignore npm commands",
"regex": "npm",
"instrument": false
}
Startup scripts such as, /opt/tomcat/bin/startup.sh
launch the Java applications internally with certain parameters. Auto-attach monitors the launch of the Java application and not of the shell script(s).