CloudMonitor collects the metrics of hosts by using the exporters installed on on-premises middleware instances and reports these metrics to the specified namespace by using the CloudMonitor agent. Then, CloudMonitor displays the monitoring data in charts. You can use a monitoring dashboard in Hybrid Cloud Monitoring to create custom charts. You can also configure Prometheus alert rules to receive alert notifications.

Prerequisites

A namespace is created. For more information, see Create a namespace.

Step 1: Install an exporter for each on-premises middleware instance

The following example shows how to install an exporter on a Linux server where the Redis middleware is deployed.

  1. Log on to the host where the middleware resides as the root user.
  2. Run the following command to download the installation package of the exporter:
    wget https://cms-prometheus.oss-cn-hangzhou.aliyuncs.com//redis/redis_exporter_linux_amd64
  3. Run the following command to grant the execute permissions on the redis_exporter_linux_amd64 file:
    chmod +x redis_exporter_linux_amd64
  4. Run the following command to change the name of the redis_exporter_linux_amd64 file to redis_exporter:
    mv redis_exporter_linux_amd64 redis_exporter
  5. Run the following command to install the exporter and start the service:
    ./redis_exporter -redis.addr localhost:6379 -web.listen-address localhost:9121
  6. Run the following command to check whether the exporter is installed:
    ps -ef | grep "redis_exporter"
    If the following information is displayed, the exporter is installed.
    root      461050  460640  0 15:46 pts/0    00:00:00 ./redis_exporter -redis.addr localhost:6379 -web.listen-address localhost:9121root      461166  461128  0 15:47 pts/5    00:00:00 grep --color=auto redis_exporter

Step 2: Install the CloudMonitor agent on a host

This section describes how to install the CloudMonitor agent on a host that is accessible or inaccessible over the Internet. In this example, the host runs Linux.
Note If you have multiple middleware instances, you can install the CloudMonitor agent on a host in the cluster. The CloudMonitor agent can collect metrics from multiple exporters at the same time. You do not need to install the CloudMonitor agent on the host of each middleware instance. For example, if a cluster contains multiple Redis instances, you need to install an exporter on the host where each Redis instance resides. You do not need to install the CloudMonitor agent on the host where each Redis instance resides.

Note If the CloudMonitor agent is installed on the host but the host is inaccessible over the Internet, the monitoring data cannot be reported to CloudMonitor. You must configure a proxy server in the CloudMonitor agent. For more information, see Substep 2 in Step 2: Install and configure the CloudMonitor agent.

  1. Install a proxy server.

    An NGINX proxy server is used in this example. For more information, see Substep 1 to Substep 4 in Step 1: Deploy an NGINX proxy server.

  2. Log on to the CloudMonitor console.
  3. Click the command displayed in the Installation Command section.
  4. Log on to the host on which you want to install the CloudMonitor agent as the root user.
  5. Paste and run the command to install the CloudMonitor agent.

    Replace the parameters in the following command with the actual values. Keep the default values of other parameters.

    CMS_HTTP_PROXY=<Address of the proxy server>:<Port number>

  6. Run the following command to view the status of the CloudMonitor agent:

    ps aux | grep argusagent | grep -v grep

    The following output indicates that the CloudMonitor agent is running properly:

    root      2284  0.0  0.0  22516  1488 ?        Ss   Sep14   0:00 /usr/local/cloudmonitor/bin/argusagent -d
    root      2286  0.2  0.3 939652 14300 ?        Sl   Sep14   3:15 /usr/local/cloudmonitor/bin/argusagent

  1. Log on to the CloudMonitor console.
  2. Click the command displayed in the Installation Command section.
  3. Log on to the host on which you want to install the CloudMonitor agent as the root user.
  4. Paste and run the command to install the CloudMonitor agent.
  5. Run the following command to view the status of the CloudMonitor agent:

    ps aux | grep argusagent | grep -v grep

    The following output indicates that the CloudMonitor agent is running properly:

    root      2284  0.0  0.0  22516  1488 ?        Ss   Sep14   0:00 /usr/local/cloudmonitor/bin/argusagent -d
    root      2286  0.2  0.3 939652 14300 ?        Sl   Sep14   3:15 /usr/local/cloudmonitor/bin/argusagent

Step 3: Create a metric import task for the data center

After you create a metric import task for the data center, the CloudMonitor agent reports the metrics of hosts to the specified namespace and visualizes the related monitoring data in charts.

  1. In the left-side navigation pane, choose Hybrid Cloud Monitoring > Namespace.
  2. Optional. Find the namespace and click Manage Import Tasks in the Metric Data column.
    Note This operation is required only if two or more namespaces are displayed on the Namespaces tab.
  3. Click the Other Metrics tab. Then, click Import Other Metrics.
  4. On the Data Center tab, configure the basic information of the metric import task and click Next.
    • Select Middleware to Be Monitored: Select Redis from the drop-down list.
    • Task Name: Enter the name of the metric import task.
    • Select Host: Select a host on which the CloudMonitor agent installed.
  5. In the Data Access Check step, confirm that the latest version of the CloudMonitor agent is installed on the host and an exporter is installed on the middleware. Then, click Next.
  6. In the Task Details step, specify the URL of the exporter and click Next.
  7. In the Dashboard step, click Close.

Step 4: View the monitoring chart for on-premises data

You can view the monitoring chart for a specified metric of hosts.

  1. On the Namespaces tab, find the namespace and click View Data in the Metric Data column.
  2. On the View Data page, select a metric.

Step 5: Create custom charts for on-premises data

You can use the dashboard feature of Hybrid Cloud Monitoring to create a monitoring dashboard for the metrics of hosts and create custom charts.

  1. In the left-side navigation pane, choose Hybrid Cloud Monitoring > Dashboards.
  2. On the Dashboards tab, click View Dashboard.
  3. In the left-side navigation pane of the dashboard, click the Create icon. Then, click Add new panel.
  4. On the Edit Panel page, configure metrics and monitoring charts.
    • On the Query tab, select the namespace and select metrics.
    • On the Panel tab, specify a panel title and enter a description. Then, configure visualization and other settings.
  5. In the upper-right corner of the Edit Panel page, click Apply.
    The monitoring chart is created.
  6. In the upper-right corner, click the Save the dashboard icon. Then, specify the name of the dashboard and the directory in which the dashboard resides.
  7. Click Save.
    The dashboard is created.
  8. In the left-side navigation pane of the dashboard, choose Dashboard > Manage to view the dashboard.

Step 6: Configure an alert rule for on-premises data

You can configure alert rules for the metrics of hosts. If the specified conditions are met, you can receive alert notifications.

  1. In the left-side navigation pane, choose Hybrid Cloud Monitoring > Namespaces.
  2. In the upper-right corner of the Namespaces tab, click Create Alert.
  3. In the Create Alert Rule panel, enter a name in the Rule Name field, select a namespace from the Namespace drop-down list, set the Alert Expression (PromQL) parameter, and then select an alert contact group from the Alert Contact Group drop-down list.
  4. Click OK.