Help Center/ Application Performance Management/ Best Practices(2.0)/ Connecting On-premises Services to APM
Updated on 2024-06-14 GMT+08:00

Connecting On-premises Services to APM

Background

You cannot connect on-premises services to APM using Direct Connect. To access APM, configure a proxy.

Configuration Method

If the network between your host and APM is disconnected, configure a proxy.

  1. Configure a proxy.

    1. Log in to the AOM 2.0 console.
    2. On the menu bar, choose Collection Management.
    3. In the navigation tree on the left, choose UniAgent > Proxy Areas. The Proxy Areas page is displayed.
    4. Click Add Proxy and set related parameters.
      Figure 1 Adding a proxy
      Table 1 Parameters for adding a proxy

      Parameter

      Description

      Example Value

      Proxy Area

      Select the created proxy area.

      region

      Host

      Select a host where the UniAgent has been installed.

      -

      Proxy IP Address

      Set the IP address of the proxy.

      -

      Port

      Enter a port number, which cannot be greater than 65535.

      -

    5. Click OK.

  2. Configure the JavaAgent.

    1. Download the JavaAgent package to any directory of the host to be connected to APM.

      Example command:

      curl -O https://xxx/apm-javaagent-x.x.x.tar
      Download Agent 2.4.1: curl -k https://apm2-javaagent-cn-north-4.obs.cn-north-4.myhuaweicloud.com/apm_agent_install2.sh -o apm_agent_install.sh && bash apm_agent_install.sh -ak {APM_AK} -sk {APM_SK} -masteraddress https://xx.xx.xx.xx:41333 -obsaddress https://apm2-javaagent-cn-north-4.obs.cn-north-4.myhuaweicloud.com -version 2.4.1; history -cw; history –r
    2. Run the tar command to decompress the JavaAgent package.

      Example command:

      tar -xvf apm-javaagent-x.x.x.tar
    3. Modify the apm.config file in the JavaAgent package. Add apm.proxy to the configuration file, as shown in the following figure.
      Figure 2 Configuration file
      • Agents of 2.4.1 and later support access through a proxy. Format: apm.proxy=ip:port (Obtain ip:port from the AOM console.)
      • To obtain an AK/SK, see Access Keys.
      • To obtain the master.address, see Access Address (master.address).

  3. Restart the application.

    1. Modify the startup script of the Java process.

      Add the path of the apm-javaagent.jar package and the component name of the Java process to the end of the Java command in the service startup script.

      Example of adding -javaagent parameters:

      java -javaagent:/xxx/apm-javaagent/apm-javaagent.jar=appName={appName}
    2. Restart the application.