If you want to view and analyze the metrics of a machine, you can use Metricbeat to collect the metrics. Then, Metricbeat sends the collected data to an Alibaba Cloud Elasticsearch cluster. You can view the data on the related dashboard in the Kibana console of the cluster. This topic uses a computer that runs the macOS operating system to describe the detailed procedure.
- An Alibaba Cloud Elasticsearch cluster is created. For more information, see Create an Elasticsearch cluster.
Note If you want to access the Elasticsearch cluster by using its internal endpoint, you must purchase an Elastic Compute Service (ECS) instance. This instance must reside in the same virtual private cloud (VPC), region, and zone as the Elasticsearch cluster.
- Metricbeat is downloaded.
Beats is a platform for single-purpose data shippers. After the data shippers are installed, they send data from thousands of machines and systems to Logstash or Elasticsearch.
Metricbeat is a lightweight data shipper that collects metrics from your systems and services. System metrics include CPU and memory metrics. Service metrics include Redis and NGINX metrics.
- Configure an Alibaba Cloud Elasticsearch cluster
- Configure Metricbeat
- View the related dashboard in the Kibana consoleNote You can also use Metricbeat to collect metrics from a computer that runs the Linux or Windows operating system. Then, Metricbeat sends the metrics to Alibaba Cloud Elasticsearch.
Configure an Alibaba Cloud Elasticsearch cluster
- Log on to the Alibaba Cloud Elasticsearch console.
- In the top navigation bar, select the region where your cluster resides.
- In the left-side navigation pane, click Elasticsearch Clusters. On the Clusters page, find your Elasticsearch cluster. Then, click its ID in the Cluster ID/Name column or Manage in the Actions column.
- In the left-side navigation pane, click Security.
- On the page that appears, turn on Public Network Access and click Update next to Public Network Whitelist. Then, enter the public IP address of your computer.Notice If you are using a public network such as Wi-Fi, add the IP address of the jump server that controls outbound traffic of the public network to the whitelist. If you cannot obtain this IP address, we recommend that you add
0.0.0.0/1,22.214.171.124/1to the whitelist. These two CIDR blocks are used in this topic. This configuration allows almost all public IP addresses to access the Elasticsearch cluster. We recommend that you evaluate the risks before you use this configuration.
- In the left-side navigation pane, click Basic Information. On the page that appears, you can obtain the public endpoint of your Elasticsearch
cluster for future use.
- In the left-side navigation pane, click Cluster Configuration. On the page that appears, click Modify Configuration on the right side of YML Configuration. In the YML File Configuration pane, set Auto Indexing to Enable.Warning This configuration takes effect only after your Elasticsearch cluster is restarted. To prevent impacts on your business, exercise caution when you change the settings of Auto Indexing.
- Select This operation will restart the cluster. Continue? and click OK. You can view the restart progress in the Tasks dialog box. The configuration of the cluster takes effect after your Elasticsearch cluster is restarted.
- Decompress the Metricbeat installation package you have downloaded and go to the Metricbeat
- Open the metricbeat.yml file and edit the
Elasticsearch outputsection in it. You must uncomment the involved content.
The internal or public endpoint that is used to access the Elasticsearch cluster. The public endpoint is used to access the Elasticsearch cluster in this topic.
Set this parameter to
The default value of this parameter is
The password that is used to access the Elasticsearch cluster. This password is specified when you create the cluster.
- Run the following command to start Metricbeat:
./metricbeat -e -c metricbeat.ymlAfter Metricbeat is started, it begins to send data to your Elasticsearch cluster.
View the related dashboard in the Kibana console
- Log on to the Kibana console of your Elasticsearch cluster.For more information, see Log on to the Kibana console.
- In the left-side navigation pane, click Management and follow these steps to create an index pattern:
Notice If you have created an index pattern, skip this step.
- In the Kibana section of the Management page, click Index Patterns.
- In the Create index pattern section, enter an index pattern name (the name of the index that you want to query).
- Click Next step.
- Click Create index pattern.
- In the left-side navigation pane, click Dashboard.
- On the Dashboards page, you can view the collected data.
- The following figure shows relevant metrics.
- Click Metricbeat-cpu to view CPU metrics.Note You can configure metrics to be refreshed at 5-second intervals. The system generates reports for the metrics collected at these intervals. You can also connect to WebHook to configure alerts.