AOM can discover applications and collect their metrics based on configured rules. There are two modes to configure application discovery: auto mode and manual mode. This section mainly describes the manual mode.
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 Discovery Rules and displays them on the Application Monitoring page.
If you customize an application discovery rule 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 custom rule and displays them on the Application Monitoring page.
The ICAgent will periodically implement detection on the target host to find out all its processes. The effect is similar to that of running the ps -e -o pid,comm,lstart,cmd | grep -v defunct command on the target host. 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 out and is discovered by AOM.
Information similar to the following is displayed:
PID COMMAND STARTED CMD1 systemd Tue Oct 2 21:12:06 2018 /usr/lib/systemd/systemd --switched-root --system --deserialize 202 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 -P1144 sshd Tue Oct 2 21:12:27 2018 /usr/sbin/sshd -D1148 agetty Tue Oct 2 21:12:27 2018 /sbin/agetty --keep-baud 115200 38400 9600 hvc0 vt2201154 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
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/. |
AOM provides two built-in discovery rules: Sys_Rule and Default_Rule. These rules are executed on all hosts, including hosts added later. The priority of Sys_Rule is higher than that of Default_Rule. That is, Sys_Rule is executed on the host first. If Sys_Rule is met, Default_Rule is not executed. Otherwise, Default_Rule is executed. Rule details are as follows:
Sys_Rule (cannot be disabled)
When Sys_Rule is used, the component name and application name must be used together. The names are determined according to the following priorities:
In the following example, the component name is atps-demo and the application name is atpd-test.
PAAS_MONITORING_GROUP=atpd-testPAAS_APP_NAME=atps-demoJAVA_TOOL_OPTIONS=-javaagent:/opt/oss/servicemgr/ICAgent/pinpoint/pinpoint-bootstrap.jar -Dapm_application=atpd-test -Dapm_tier=atps-demo
Default_Rule (can be disabled)
For example, AOM can detect the processes whose command parameters contain ovs-vswitchd unix: and environment variables contain SUDO_USER=paas.
If no process is detected within 20s, modify the discovery rule and detect processes again. Only when at least one process is detected can you proceed to the next step.
Set an application name.
In the Application Name Settings area, click Add Naming Rule to set an application name for the detected process.
In the Component Name Settings area, specify an application type and click Add Naming Rule to set a component name for the discovered process. For example, add the text app-test as a component name.
If the name does not meet your requirements, click
in the Preview Component Name table to rename the component.
After creating an application discovery rule, perform the operations listed in Table 2 if needed.
Operation | Description |
|---|---|
Viewing rule details | In the Name column, click the name of an application discovery rule. |
Enabling or disabling a rule |
|
Deleting a rule |
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. |