Auto-Attach Java and NodeJS Agents
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
This includes the information about the auto-attach configuration for Java and Node.js applications.
You can overwrite the default ld_preload.json
(attaches the agent to all supported Java frameworks and Node.js 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.
Scenario Examples
You can update the ld_preload.json
file based on the following scenarios:
Scenario | Update to ld_preload.json |
---|---|
To deactivate auto-attach feature for any of the Java processes. |
|
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. |
Here, custom_path is the custom path where Java Agent is installed. |
To auto-generate the application, tier, and node names. |
Here, TomcatApp, Tier, and Node are examples of the suffix that you want to use for all the entities. This can be changed based on what you require as the suffix. 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).