Updated on 2026-09-20 GMT+08:00

Connecting a Demo Application to APM

If you do not have your own applications, learn APM by using a demo application. This section describes how to connect a demo application to APM for monitoring.

Procedure

Step 1: Prepare the Environment

  1. Subscribe to APM. If you log in to the APM console for the first time, click Free opening.
  2. Purchase an ECS and ensure that it meets the requirements in Supported OSs.
    • To ensure performance, you are advised to purchase an ECS with two or more vCPU cores and 4 GB or greater memory.
  3. Remotely log in to the ECS server as a root user.
  4. Create an application directory, for example, testdemo, and go to the directory:
    mkdir /root/testdemo
    cd /root/testdemo
  5. Download and install the JDK installation package.

    As the JDK installation package has been downloaded from the official JDK website and placed in http://demos.obs.myhuaweicloud.com, run the following command to download and install it:

    curl -l http://demos.obs.myhuaweicloud.com/jdk_install.sh > jdk_install.sh && bash jdk_install.sh
  6. Download the application to the application directory and install it.

    As the application has been placed in http://demos.obs.myhuaweicloud.com, run the following command to download and install it:

    curl -l http://demos.obs.myhuaweicloud.com/demo_install.sh > demo_install.sh && bash demo_install.sh

Step 2: Install the ICAgent

  1. Obtain an Access Key ID/Secret Access Key (AK/SK).
  2. Log in to the APM console.
  3. In the navigation pane, choose Agent > Management.
  4. Click Install ICAgent. On the page that is displayed, set Host to HUAWEI CLOUD host and OS to Linux.
  5. Select the Obtain AK/SK installation mode, enter the obtained AK/SK in the text box to generate the ICAgent installation command, and click Copy Command.

    Ensure that the AK/SK are correct. Otherwise, the ICAgent cannot be installed.

  6. Remotely log in to the ECS as the root user and run the preceding command to install the ICAgent.

    When the message "ICAgent install success" is displayed, the ICAgent is successfully installed in the /opt/oss/servicemgr/ directory.

    When the Java process is deployed on a CCE cluster node, ICAgent is installed in the /var/opt/oss/servicemgr/ directory.

    When the Java process is deployed on an ECS cluster node, ICAgent is installed in the /opt/oss/servicemgr/ directory.

Step 3: Enable Application Monitoring

After the ICAgent is installed, modify the application startup parameters to enable application performance monitoring and load the ICAgent. Otherwise, the application cannot be monitored by APM. APM has provided the modified script for the demo application. You only need to execute the modified script on the ECS where the demo application is deployed:

cd /root/testdemo
chmod +x start_apminside.sh
bash start_apminside.sh

Step 4: Manage the Application on APM

  1. Three minutes after the application is started, its data will be displayed on the APM console. You can log in to the APM console and optimize application performance through topology and tracing. For details, see APM User Guide.

  2. (Optional) To access the demo application, perform the following operations:
    1. Configure the security group rule. Specifically, configure the access permission for port 80 of the security group in the inbound direction so that you can access the demo application using a browser.
    2. Open a browser, enter http://ECS EIP in the address bar to access the demo application, and perform operations such as querying products and viewing shopping carts.