This topic describes how to use Alibaba Cloud Metricbeat to collect system data and
NGINX service data and then generate visual charts. The system data includes CPU utilization,
memory usage, disk I/O, and network I/O.
Prerequisites
- An Alibaba Cloud Elasticsearch cluster is created.
For more information, see Create an Elasticsearch cluster.
- The Auto Indexing feature is enabled for the Elasticsearch cluster.
For security purposes, Alibaba Cloud Elasticsearch disables the Auto Indexing feature by default. However, Beats depends on this feature. If you select Elasticsearch for Output when you create a shipper, you must enable the Auto Indexing feature. For more information, see Enable auto indexing.
- An Alibaba Cloud Elastic Compute Service (ECS) instance is created in the same Virtual
Private Cloud (VPC) as the Elasticsearch cluster.
For more information, see Create an instance by using the provided wizard.
Notice Beats supports only Aliyun Linux, Red Hat Linux, and CentOS.
- Cloud Assistant and Docker are installed on the ECS instance.
For more information, see Install the Cloud Assistant client and Build Docker.
Use Metricbeat to collect system data
- Log on to the Alibaba Cloud Beats console.
- In the Create Shipper section of the page that appears, click Metricbeat.
- Install and configure the shipper.
- Click Next.
- Select the target ECS instance.
Notice If you are installing a shipper for the first time, click Authorize Now. Then, follow the instructions to authorize Elasticsearch to access ECS instances.
- Enable the shipper and check whether the shipper installation succeeds.
- Click Enable.
Then, the Enable Shipper message appears.
- Click Back to Beats Shippers. In the Manage Shippers section of the Beats Data Shippers page, view the installed shipper.
- After the state of the shipper changes to Enabled 1/1, click View Instances in the Actions column.
- In the View Instances pane, check whether the shipper installation on the ECS instance succeeds. If the
value of Installed Shippers is Heartbeat Normal, the shipper installation succeeds.
- View the collected data.
- Log on to the Kibana console of your Elasticsearch cluster.
- In the left-side navigation pane, click Dashboard.
- In the Dashboards section, click [Metricbeat System] Overview. On the page that appears, click the target Metricbeat system and view the dashboard
for the system.
Use Metricbeat to collect NGINX service data
Prerequisites: The
stub_status
module is enabled for the NGINX service. The
ngx_http_stub_status_module
module measures the number of requests received and that of requests processed by
the NGINX service. Therefore, you must enable
stub_status
in the nginx.conf file.
location /status {
stub_status on;
access_log off;
}
Notice The value of server_status_path
in the metricbeat.yml file must be the same as that of status
in the nginx.conf file.
- Log on to the Alibaba Cloud Beats console.
- In the Create Shipper section of the page that appears, click Metricbeat.
- Install and configure the shipper.
For more information, see
Install a shipper and
Prepare the YML configuration files for a shipper. The following figure shows the configurations that are used in this topic.
Add the following script in the
metricbeat.yml file:
metricbeat.modules:
- module: nginx
metricsets: ["stubstatus"]
enabled: true
period: 10s
# Nginx hosts
hosts: ["http://121.41.**.**"]
# Path to server status. Default server-status
server_status_path: "status"
Note
- If you select Enable Kibana Monitoring, the system enables Metricbeat service monitoring in the Kibana console.
- If you select Enable Kibana Dashboard, the system generates charts in the Kibana console. You do not need to configure
the YML file. Alibaba Cloud Kibana is configured in a VPC. You must enable the Kibana
private network access feature on the Kibana configuration page. For more information,
see Configure a whitelist for access to the Kibana console over the Internet or an internal network.
- Click Next.
- Select the target ECS instance.
Notice If you are installing a shipper for the first time, click Authorize Now. Then, follow the instructions to authorize Elasticsearch to access ECS instances.
- Enable the shipper and check whether the shipper installation succeeds.
- View the collected data.
- In the address bar of your browser, enter
<IP address of the NGINX server>/status
to access the monitoring page of the NGINX server.
- Log on to the Kibana console of your Elasticsearch cluster.
- In the left-side navigation pane, click Dashboard.
- In the Dashboards section, click [Metricbeat Nginx] Overview. On the page that appears, view the dashboard for the NGINX service.