Updated on 2024-04-15 GMT+08:00

Configuring Application Discovery

AOM can discover applications and collect their metrics based on configured rules. Application discovery supports both automatic and manual configuration. This section focuses on manual configuration.

  • Automatic configuration

    After you install the ICAgent on a host according to Installing an ICAgent, the ICAgent automatically discovers applications on the host based on Built-in Service Discovery Rules and displays them on the Application Monitoring page.

  • Manual configuration

    After you add a custom application discovery rule on the application discovery page and apply it to the host where the ICAgent is installed (for details, see Installing an ICAgent), the ICAgent discovers applications on the host based on the configured service discovery rule and displays them on the Application Monitoring page.

Filtering Rules

The ICAgent will periodically detect processes on the target host. The effect is similar to that of running the ps -e -o pid,comm,lstart,cmd | grep -v defunct command. Then, the ICAgent checks whether processes match the filtering rules in Table 1. If a process meets a filtering rule, the process is filtered out and is not discovered by AOM. If a process does not meet any filtering rules, the process is not filtered and is discovered by AOM.

ICAgent detection results may as follows:

   PID COMMAND                          STARTED CMD
     1 systemd         Tue Oct  2 21:12:06 2018 /usr/lib/systemd/systemd --switched-root --system --deserialize 20
     2 kthreadd        Tue Oct  2 21:12:06 2018 [kthreadd]
     3 ksoftirqd/0     Tue Oct  2 21:12:06 2018 (ksoftirqd/0)
  1140 tuned           Tue Oct  2 21:12:27 2018 /usr/bin/python -Es /usr/sbin/tuned -l -P
  1144 sshd            Tue Oct  2 21:12:27 2018 /usr/sbin/sshd -D
  1148 agetty          Tue Oct  2 21:12:27 2018 /sbin/agetty --keep-baud 115200 38400 9600 hvc0 vt220
  1154 docker-containe Tue Oct  2 21:12:29 2018 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc --metrics-interval=0
Table 1 Filtering rules

Filtering Rule

Example

If the COMMAND value of a process is docker-containe, vi, vim, pause, sshd, ps, sleep, grep, tailf, tail, or systemd-udevd, and the process is not running in the container, the process is filtered out and is not discovered by AOM.

In the preceding information, the process whose PID is 1154 is not discovered by AOM because its COMMAND value is docker-containe.

If the CMD value of a process starts with [ and ends with ], the process is filtered out and is not discovered by AOM.

In the preceding information, the process whose PID is 2 is not discovered by AOM because its CMD value is [kthreadd].

If the CMD value of a process starts with ( and ends with ), the process is filtered out and is not discovered by AOM.

In the preceding information, the process whose PID is 3 is not discovered by AOM because its CMD value is (ksoftirqd/0).

If the CMD value of a process starts with /sbin/, the process is filtered out and is not discovered by AOM.

In the preceding information, the process whose PID is 1148 is not discovered by AOM because its CMD value starts with /sbin/.

Built-in Service Discovery Rules

AOM provides Default_Rule, and ICAgent has the built-in Sys_Rule. These rules are executed on all hosts, including those added later. The priorities of the built-in discovery rules are as follows: Sys_Rule > Default_Rule. Rule details are as follows:

Sys_Rule (cannot be disabled)

When Sys_Rule is used, both the component name and application name must be set. The names are determined according to the following priorities:

  • Priorities for determining the application name:
    1. Use the value of the Dapm_application field in the process startup command.
    2. If the value in 1 is empty, use the value of the Dapm_application field in the JAVA_TOOL_OPTIONS variable.
    3. If the value in 2 is empty, use the value of the PAAS_MONITORING_GROUP variable.
    4. If the value in 3 is empty, use the value of the DAOM.APPN field in the process startup command.
  • Priorities for determining the component name:
    1. Use the value of the DAOM.PROCN field in the process startup command. If the value is empty, use the value of the Dapm_tier field.
    2. If the value in 1 is empty, use the value of the Dapm_tier field in the JAVA_TOOL_OPTIONS variable.
    3. If the value in 2 is empty, use the value of the PAAS_APP_NAME variable.
In the following example, the component name is atps-demo and the application name is atpd-test.
PAAS_MONITORING_GROUP=atpd-test
PAAS_APP_NAME=atps-demo
JAVA_TOOL_OPTIONS=-javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=atpd-test -Dapm_tier=atps-demo
Default_Rule (can be disabled)
  • If the COMMAND value of a process is java, obtain the name of the JAR package in the command, the main class name in the command, and the first keyword that does not start with a hyphen (-) in the command based on the priorities in descending order as the component name, and use the default value unknownapplicationname as the application name.
  • If the COMMAND value of a process is python, obtain the name of the first .py/.pyc script in the command as the component name, and use the default value unknownapplicationname as the application name.
  • If the COMMAND value of a process is node, obtain the name of the first .js script in the command as the component name, and use the default value unknownapplicationname as the application name.

Custom Discovery Rules

The priorities of discovery rules are as follows: Sys_Rule > Custom discovery rules > Default_Rule.

  1. On the menu bar, choose Monitoring Center.
  2. In the navigation pane, choose Configuration Management > Application Discovery.
  3. Click Add Custom Application Discovery Rule and configure an application discovery rule.
  4. Select a host for pre-detection.

    1. Customize a rule name, for example, rule-test.
    2. Select a typical host, for example, host-test, to check whether the application discovery rule is valid. The hosts that execute the rule will be configured in 7. Then, click Next.

  5. Set an application discovery rule.

    1. Click Add Check Items. AOM can discover processes that meet the conditions of check items.
      For example, AOM can detect the processes whose command parameters contain ovs-vswitchd unix: and environment variables contain SUDO_USER=paas.
      • To precisely detect processes, you are advised to add check items about unique features of the processes.
      • You need to add one check item at least and can add five check items at most. If there are multiple check items, AOM only discovers the processes that meet the conditions of all check items.
    2. After adding check items, click Detect to search for the processes that meet the conditions.

      If no process is detected within 10s, modify the application discovery rule and detect processes again. Go to the next step only when at least one process is detected.

  6. Set a component name.

    1. Set an application name.
      In the Application Name Settings area, click Add Naming Rule to set an application name for the discovered process.
      • If you do not set an application name, unknownapplicationname is used by default.
      • When you add multiple naming rules, all the naming rules are combined as the application name of the process. Metrics with the same application name are aggregated.
    2. Set a component name.
      In the Component Name Settings area, click Add Naming Rule to set a component name for the discovered process.
      • The component name cannot be left blank.
      • When you add multiple naming rules, all the naming rules are combined as the component name of the process. Metrics with the same component name are aggregated.
    3. Preview the component name.

      If the application or component name does not meet your requirements, locate the name in the Preview Component Name table and rename it.

  7. Set a priority and detection range.

    1. Set a priority: When there are multiple rules, set priorities. Enter 1 to 9999. The default value is 9999. The smaller value, the higher priority. For example, 1 indicates the highest priority and 9999 indicates the lowest priority.

      Do not use multiple custom discovery rules with the same priority for the same process.

    2. Set a detection range: Select a host to be detected. That is, select the host to which the configured rule is applied. If no host is selected, this rule will be executed on all hosts, including those added later.

  8. Click Add to complete the configuration. AOM collects metrics of the process.
  9. Wait for about two minutes, choose Infrastructure Monitoring > Component Monitoring in the navigation pane, select the target host (for example, host-test) from the cluster drop-down list, and find the target component (for example, /openvswitch/) that has been monitored.

More Operations

After creating an application discovery rule, you can also perform the operations described in Table 2.

Table 2 Related operations

Operation

Description

Viewing rule details

In the Name column, click the name of an application discovery rule.

Enabling or disabling a rule

  • Click Enable in the Operation column.
  • Click Disable in the Operation column. After a rule is disabled, AOM does not collect process metrics.

Deleting a rule

  • To delete a discovery rule, click Delete in the Operation column.
NOTE:

Built-in application discovery rules cannot be deleted.

Modifying a rule

Click Modify in the Operation column.

NOTE:

Built-in application discovery rules cannot be modified.