All Products
Search
Document Center

Application Real-Time Monitoring Service:How do I customize the path for mounting an ARMS agent for Java?

Last Updated:Apr 02, 2025

Background information

Typically, the ack-onepilot component specifies the mount path for Application Real-Time Monitoring Service (ARMS) agents for Java by injecting the environment variable JAVA_TOOL_OPTIONS. However, you may need to customize this path for scenarios such as:

  • Centralized configuration management

    Manage the mount path through a Kubernetes ConfigMap to ensure environment consistency.

  • Persistent storage

    Store agent files in a custom persistent volume claim (PVC) to meet enterprise security or O&M requirements.

Version requirements

To customize the mount path for ARMS agents for Java, these version requirements must be met:

Solution

Note

This configuration also applies to Microservice Engine (MSE) due to shared ack-onepilot integration.

  1. Add the disableJavaToolOptionsInjection annotation to the Kubernetes workload, such as a deployment, that requires a custom mount path.

    The ack-onepilot component will not automatically set the mount path or other Java Virtual Machine (JVM) parameters using the environment variable JAVA_TOOL_OPTIONS.

    1. To view the YAML file of the deployment, run the following command:

      kubectl get deployment {Deployment name} -o yaml
      Note

      If you're not sure about the deployment name, run the following command to list all deployments:

      kubectl get deployments --all-namespace

      Then, find the one you want in the results and view its YAML file.

    2. Run the following command to edit the YAML file:

      kubectl edit deployment {Deployment name} -o yaml
    3. In the YAML file, add the following labels to spec.template.metadata:

      labels:
        armsPilotAutoEnable: "on"
        armsPilotCreateAppName: "<your-deployment-name>"    # The name of your deployment.
        disableJavaToolOptionsInjection: "true" # If you want to customize the mount path for the ARMS agent for Java, set this parameter to true.
  2. Replace the default mount path /home/admin/.opt/AliyunJavaAgent/aliyun-java-agent.jar in your Java startup script or command with your custom path:

    java -javaagent:/home/admin/.opt/AliyunJavaAgent/aliyun-java-agent.jar ... ... -jar xxx.jar

    Other information such as the reporting region and license key is provided by ack-onepilot through environment variables.