You can create metric import tasks for self-managed data centers to import metric data to CloudMonitor. After the metric data is imported to CloudMonitor, you can create a dashboard to view the monitoring chart of a specified metric.
Prerequisites
CloudMonitor is connected with your data center and CloudMonitor is connected with the hosts whose middleware that you want to monitor in the data center.
A namespace is created. For more information, see Create a namespace.
Create a metric import task
Install the CloudMonitor agent on the host.
For more information, see Install and uninstall the CloudMonitor agent for C++.
Install an exporter for the middleware of the self-managed data center.
The following example shows how to install an exporter on a Redis instance.
Important You can install the CloudMonitor agent and exporters only by using an administrator account. For Linux operating systems, use the root user account. For Windows operating systems, use the Administrator account. If you use an administrator account, certain risks may occur. For example, system stability or data security issues may occur. Proceed with caution.Windows
Log on to the host where the middleware resides as the administrator.
Visit the download URL of the exporter and download the redis_exporter_win_amd64 exporter installation package to a local path.
NoteIf you want to install the exporter for a different middleware, replace
redis
with the name of the middleware in the download URL.Double-click redis_exporter_win_amd64 to install the exporter.
View the installation result of the exporter.
- Open the command prompt window.
Press Win+R. In the Run dialog box, enter cmd and click OK.
Run the following command to view the exporter status:
tasklist | findstr "redis"
If the following information is displayed, the exporter is installed.
redis_exporter_win_amd64. 4496 RDP-Tcp#37 3 7,924 K
- Open the command prompt window.
Linux
NoteIn the following commands, you must replace
redis
with the name of the middleware.Log on to the host where the middleware resides as the root user.
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
Run the following command to grant the execute permissions on the redis_exporter_linux_amd64 file:
chmod +x redis_exporter_linux_amd64
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
Run the following command to install the exporter and start the service:
./redis_exporter -redis.addr localhost:6379 -web.listen-address localhost:9121
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:9121 root 461166 461128 0 15:47 pts/5 00:00:00 grep --color=auto redis_exporter
Create a metric import task.
- Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
Find the namespace and click the icon for account quantity, cloud service quantity, metric quantity, or task quantity in the Metric Data column.
NoteTask quantity indicates the total number of tasks that are used to import metrics from self-managed data centers, AWS, Tencent Cloud, and Prometheus, on-premises log monitoring data, and Simple Log Service log monitoring data.
In the Metric management panel, click the Data Center tab. On the Data Center tab, click Metric Data.
In the Basic Task Information step of the Metric Data dialog box, configure the basic information of the metric import task and click Next.
Parameter
Description
Select Middleware to Be Monitored
The middleware of the host. Valid values: Spring, Tomcat, Nginx, Tengine, JVM, Redis, Mysql, and Others.
Custom Middleware
The name of the custom middleware.
If you select Others from the Select Middleware to Be Monitored drop-down list, you must enter the name of the custom middleware.
Task Name
The name of the metric import task.
Task Description
The description of the metric import task.
Select Host
One or more hosts of the self-managed data center.
NoteYou must make sure that the CloudMonitor agent is installed on all the selected hosts.
Region
The region where the host resides.
NoteYou can click Advanced Options to configure this parameter.
Network Type
The network type of the host. Valid values:
VPC
classic
NoteYou can click Advanced Options to configure this parameter.
In the Data Access Check step, check whether the latest version of the CloudMonitor agent and the exporter are installed, and click Next.
In the Task Details step, enter the URL of the collection target, select the interval and timeout period for data collection, set tags for the metric import task, and then click Next.
In the Dashboard step, click Close.
Modify a metric import task
- Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
Find the namespace and click the icon for account quantity, cloud service quantity, metric quantity, or task quantity in the Metric Data column.
NoteTask quantity indicates the total number of tasks that are used to import metrics from self-managed data centers, AWS, Tencent Cloud, and Prometheus, on-premises log monitoring data, and Simple Log Service log monitoring data.
In the Metric management panel, click the Data Center tab. On the Data Center tab, find the metric import task that you want to modify and click Modify in the Actions column.
In the Basic Task Information step of the Metric Data dialog box, configure the basic information of the metric import task and click Next.
In the Data Access Check step, check whether the latest version of the CloudMonitor agent and the exporter are installed, and click Next.
In the Task Details step, enter the URL of the collection target, select the interval and timeout period for data collection, set tags for the metric import task, and then click Next.
In the Dashboard step, click Close.
Delete a metric import task
- Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
Find the namespace and click the icon for account quantity, cloud service quantity, metric quantity, or task quantity in the Metric Data column.
NoteTask quantity indicates the total number of tasks that are used to import metrics from self-managed data centers, AWS, Tencent Cloud, and Prometheus, on-premises log monitoring data, and Simple Log Service log monitoring data.
In the Metric management panel, click the Data Center tab. On the Data Center tab, find the metric import task that you want to delete and click Delete in the Actions column.
In the Confirm deletion message, click Confirm.