CloudMonitor provides the process monitoring feature to help you collect information about the active processes of Alibaba Cloud hosts during a specific period of time. You can collect the following information: CPU utilization, memory usage, and the number of opened files. If you add a process keyword, you can collect the number of processes that match the keyword.

Prerequisites

The CloudMonitor agent is installed on an Alibaba Cloud host. For more information, see Install and uninstall the CloudMonitor agent for C++.

Background information

CloudMonitor collects the top five processes with the most CPU consumption every minute. CloudMonitor records CPU utilization, memory usage, and the number of opened files in these processes.
  • CPU utilization and memory usage of a process

    You can check the output of the top command in the Linux operating system to understand the two metrics.

  • Number of opened files in a process

    You can check the output of the lsof command in the Linux operating system to understand this metric.

CloudMonitor collects the CPU utilization of only the top five processes. The following issues may occur:

  • If your process occupies multiple CPU cores, the collected CPU utilization may exceed 100%. This is because CloudMonitor collects the total CPU utilization of the process on all the occupied CPU cores.
  • If the top five processes vary during the time period specified in your query, the process list displays all the processes that have ranked top five over the specified time period. The time displayed in the list indicates when the processes last ranked top five.
  • CloudMonitor collects only CPU utilization, memory usage, and the number of opened files for a process when the process ranks top five. If a process has not stayed in the top five within the time period specified in your query, its monitoring data is displayed as dispersed data points in the monitoring charts. The density of the data points indicates the activity level of the process on the host. Examples:
    • In the following figure, the data points for the wrapper process are sparse and discontinuous in the monitoring charts. This is because the wrapper process did not continuously rank top five with the most CPU consumption during the specified time period. wrapper
    • In the following figure, the data points for the Java process are dense and continuous in the monitoring charts. This is because the Java process continuously ranked top five with the most CPU consumption during the specified time period.

Add a process

You can monitor the number and status of key processes by adding process keywords.

In this example, the following processes run on your host:
  • /usr/bin/java -Xmx2300m -Xms2300m org.apache.catalina.startup.Bootstrap
  • /usr/bin/ruby
  • nginx -c /etc/nginx/nginx.conf
You can add the following process keywords and obtain the following monitoring results:
  • ruby: One process matches this keyword by name. Therefore, the number of processes that match this keyword is 1.
  • nginx: One process matches this keyword by name and parameter. Therefore, the number of processes that match this keyword is 1.
  • /usr/bin: Two processes match this keyword by path. Therefore, the number of processes that match this keyword is 2.
  • apache.catalina: One process matches this keyword by parameter. Therefore, the number of processes that match this keyword is 1.
  • nginx.conf: One process matches this keyword by parameter. Therefore, the number of processes that match this keyword is 1.
  • -c: One process matches this keyword by parameter. Therefore, the number of processes that match this keyword is 1.
  1. Log on to the CloudMonitor console.
  2. In the left-side navigation pane, click Host Monitoring.
  3. On the Host Monitoring page, click the host name or click the Monitoring Charts in the Actions column of the host.
  4. Click the Process Monitoring tab.
  5. In the Host Process Number section, click Add Process Monitor in the upper-right corner.
  6. In the Add Process Monitor panel, enter a process name and click Add.
  7. Click the Close icon in the upper-right corner.

Delete a process

  1. Log on to the CloudMonitor console.
  2. In the left-side navigation pane, click Host Monitoring.
  3. On the Host Monitoring page, click the host name or click the Monitoring Charts in the Actions column of the host.
  4. Click the Process Monitoring tab.
  5. In the Host Process Number section, click Add Process Monitor in the upper-right corner.
  6. In the Add Process Monitor panel, find the process that you want to delete and click Delete in the Actions column.
  7. In the Delete confirmation message, click Confirm
  8. Click the Close icon in the upper-right corner.

Configure an alert rule for specific processes

After you add processes that match a specific process keyword to CloudMonitor, you can configure an alert rule for the processes. You can then receive alert notifications if the number of processes that match the process keyword changes.

  1. Log on to the CloudMonitor console.
  2. In the left-side navigation pane, click Host Monitoring.
  3. On the Host Monitoring page, click Create Alert Rule in the upper-right corner.
  4. In Create Alert Rule panel, click Add Rule. In the Add Rule Description panel, select Process from the Metric drop-down list and select (Agent)process.count_processname. Configure other parameters of the alert rule based on your business requirements.
    If multiple processes run on the host and the number of processes that match each process keyword varies, you can click Add Rule to configure alert rules for these processes. For more information about how to configure required parameters for an alert rule, see Create an alert rule.
  5. Click OK.