Alibaba Cloud Managed Service for Prometheus allows you to install and configure NGINX exporters with a few clicks. Managed Service for Prometheus also provides out-of-the-box dashboards that you can use to monitor your applications. This topic describes how to install and configure an NGINX exporter of the earlier version.
Background information
- The nginx-module-vts module is installed for NGINX exporters of the earlier version.
- The following table describes the metrics of NGINX exporters of the earlier version.
Metric Type Description nginx_server_requests Server The number of server requests. nginx_server_bytes Server The number of bytes processed by the server. nginx_server_cache Server The cache of the server. nginx_filter_requests Filter The number of filter requests. nginx_filter_bytes Filter The number of bytes processed by the filter. nginx__filter_responseMsec Filter The response time of the filter. nginx_upstream_requests Upstreams The number of upstream requests. nginx_upstream_bytes Upstreams The number of upstream bytes. nginx_upstream_responseMsec Upstreams The response time to upstream requests.
Prerequisites
The NGINX service is installed and running. The nginx-module-vts module is installed. To install the nginx-module-vts module, perform the following steps:
- Download the nginx-module-vts module. Note git@github.com:vozlt/nginx-module-vts.git
- Compile and install the nginx-module-vts module.
- Add the nginx-module-vts module to the NGINX configuration file.
--add-module=/path/to/nginx-module-vts
- Download the official software package of NGINX and compile it with the nginx-module-vts module added.
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_sysguard_module --add-module=nginx-module-vts
- Add the nginx-module-vts module to the NGINX configuration file.
- Install the nginx-module-vts module.
make && make install
- The configuration of NGINX Conf. Modify the NGINX configuration file and add a monitoring interface.
http { vhost_traffic_status_zone; vhost_traffic_status_filter_by_host on; ... server { ... location /status { vhost_traffic_status_display; vhost_traffic_status_display_format html; } } }
We recommend that you run the following command to enable vhost filtering:vhost_traffic_status_filter_by_host on
Note If you configure multiple server names, you can enable vhost filtering to ensure that the system collects traffic statistics based on different server names. If you do not enable vhost filtering, the system determines that all traffic belongs to the first server name.If you do not need to monitor traffic by region, you can run the following command to disable vhost filtering. The ellipsis (...) in the following command indicates the code that is omitted.server { ... vhost_traffic_status off; ... }
- Check whether the nginx-module-vts module is installed.
curl http://127.0.0.1/status
Entry points
Entry point 1
- Log on to the ARMS console.
- In the left-side navigation pane, choose .
- Click the name of the Prometheus instance instance that you want to manage to go to the Integration Center page.
Entry point 2: Integration Center in the ARMS console
- Log on to the Application Real-time Monitoring Service (ARMS) console.
- In the left-side navigation pane, click Integration Center. In the Application Components section, find the Nginx (old) component and click Add. In the panel that appears, configure an Nginx (old) exporter as prompted.
Configure an NGINX exporter
This section describes how to configure an NGINX exporter in the integration center of the Prometheus instance. Perform the following steps:
- Configure an NGINX exporter.
- If you install the NGINX component for the first time, perform the following operation:In the Not Installed section of the Integration Center page, find the NGINX component and click Install.
- If you have installed the NGINX component, you must add the component again.
In the Installed section of the Integration Center page, find the NGINX component and click Add.
- If you install the NGINX component for the first time, perform the following operation:
- On the Configuration tab in the STEP2 section of the panel that appears, set the parameters and click OK.
Parameter Description Exporter Name The name of the NGINX exporter. The name must meet the following requirements: - The name can contain only lowercase letters, digits, and hyphens (-) and cannot start or end with a hyphen (-).
- The name must be unique.
Note If you do not specify this parameter, the system uses the default name, which consists of the exporter type and a numeric suffix.NGINX (Old) URL The URL that is used to access the NGINX server. NGINX (Old) Port The port number of the NGINX server. Example: 80. Important- You must first install the NGINX virtual host traffic status module (nginx-module-vts). This module outputs data in the JSON format.
- You can view the monitoring metrics on the Metrics tab in the STEP2 section.
The installed components are displayed in the Installed section of the Integration Center page. Click the component. In the panel that appears, you can view information such as targets, metrics, dashboard, alerts, service discovery configurations, and exporters. For more information, see Integration center.