Beats is a platform for single-purpose data shippers. After you install Beats, the lightweight Beats agents send data from your instances to target objects, such as Logstash or Elasticsearch.
As an agent of Beats and a lightweight shipper, Metricbeat is designed to collect metrics from your systems and services, and then send the metrics to target objects, such as Elasticsearch. Metricbeat is a lightweight method to send system and service statistics from CPUs to memory, Redis to NGINX, and much more.
This topic describes how to use Metricbeat to collect metrics from a MacBook, send the metrics to an Alibaba Cloud Elasticsearch instance, and generate a corresponding dashboard in Kibana.
- Purchase and configure an Alibaba Cloud Elasticsearch instance
If you do not have an Alibaba Cloud Elasticsearch instance, you must activate Alibaba Cloud Elasticsearch and create an instance Prerequisites. You can then send the data collected from the MacBook to the Alibaba Cloud Elasticsearch instance through the internal or public IP address of the instance.Note
If you access the Alibaba Cloud Elasticsearch instance through its public IP address, you must switch on Public Address and configure a public IP address whitelist on the Security page.
If you access the Alibaba Cloud Elasticsearch instance through its internal IP address, you must create an Alibaba Cloud Elastic Compute Service (ECS) instance in the same VPC and region as the Alibaba Cloud Elasticsearch instance to manage access to the Elasticsearch.
Log on to the Alibaba Cloud Elasticsearch console, click the instance name or ID, and then click Security in the left-side navigation pane. On the Security page, switch on Public Address.
Add the public IP address of the MacBook to the whitelist.
Notice If you use a public network, add the IP address of the jump server that controls outbound network traffic of the public network to the whitelist. If you cannot obtain the IP address of the jump server, add 0.0.0.0/1,22.214.171.124/1 to the whitelist to allow a certain part of IP addresses. This setting exposes the Alibaba Cloud Elasticsearch instance to the public network. Evaluate the risks and proceed with caution.
After you complete the configuration, click Basic Information in the left-side navigation pane and copy the public IP address of the Alibaba Cloud Elaticsearch instance.
Modify the YML configuration. On the YML Configurations page, enable Create Index Automatically. By default, this feature is disabled. This operation restarts the Elasticsearch instance and takes some time to take effect.
- Download and configure Metricbeat
- Metricbeat installation package for Mac operating systems.
- Metricbeat installation package for 32-bit Linux operating systems.
- Metricbeat installation package for 64-bit Linux operating systems.
- Metricbeat installation package for 32-bit Windows operating systems.
- Metricbeat installation package for 64-bit Windows operating systems.
Download, unzip, and open the Metricbeat file.
Open and edit the Elasticsearch output section of the metricbeat.yml file. You need to uncomment the corresponding content.
Alibaba Cloud Elasticsearch provides the following access control information:
- hosts: the public or internal IP address of the Alibaba Cloud Elasticsearch instance. This example uses the public IP address.
- protocol: set to http.
- username: the default username is elastic.
- password: the password that is used to log on to Alibaba Cloud Elasticsearch.
- Activate Metricbeat
Run the following command to activate and use Metricbeat to send data to the Alibaba Cloud Elasticsearch instance.
./metricbeat -e -c metricbeat.yml
- View the dashboard in Kibana
Click Kibana Console in the upper-right corner in the Alibaba Cloud Elasticsearch console. You will be directed to the Dashboard page, as shown in the following figure:Note
If you have not created an index pattern in the Kibana console, the corresponding information may not be displayed on the dashboard. To resolve this issue, create an index pattern and view the information on the Dashboard page again.
List of metrics.
Note You can schedule the system to refresh data every five seconds and generate reports, and configure a webhook to send alerts when an exception occurs.