This topic describes how to integrate Nginx with Managed Service for Prometheus. Nginx is a high-performance, open-source web server that supports features such as reverse proxy, load balancing, and HTTP caching. Managed Service for Prometheus collects key Nginx metrics, including request counts, byte sizes, and response times. Managed Service for Prometheus provides ready-to-use dashboards to help administrators understand server performance, optimize configurations, and troubleshoot issues.
Background information
View Nginx metrics in the Integration Center of the ARMS console. In the Integration Center, search for the Nginx component, select the Collect Metrics tab, and then switch to the Kubernetes Environment tab. You can view the metrics supported for Nginx, including nginx_connections_accepted, nginx_connections_active, nginx_connections_handled, nginx_connections_reading, nginx_connections_waiting, nginx_connections_writing, nginx_http_requests_total, nginx_up, and nginxexporter_build_info. The metric types include COUNTER and GAUGE, and all metrics are in the 'common' group.
Prerequisites
-
The Nginx service is installed and running.
-
To enable Stub Status monitoring for Nginx, install the
ngx_http_stub_status_modulemodule. -
To enable VTS monitoring for Nginx, install the
nginx-module-vtsmodule.
Integrate Nginx
-
Sign in to the ARMS console. In the left-side navigation pane, go to Integration Center and click the Nginx card.
-
Configure the integration parameters.
-
Select the environment type.
-
Kubernetes Environment: The monitoring target runs in an ACK cluster.
-
ECS (VPC): The monitoring target runs on an ECS instance.
-
-
Select an ACK cluster or an ECS instance.
-
Configure the integration.
Kubernetes environment
Parameter
Description
Example
Integration name (optional)
A custom name for the integration.
nginxtest123
Enable Nginx for stub status monitoring
Enables or disables this monitoring feature.
It provides statistics on Nginx requests and connections.
NoteBefore you enable this option, make sure that the
ngx_http_stub_status_modulemodule is installed.N/A
Enable Nginx for VTS monitoring
Enables or disables this monitoring feature.
This option uses the
nginx-module-vtsmodule, which typically requires manual compilation, to collect data. It provides metrics such as Nginx request counts, byte sizes, and response times.NoteBefore you enable this option, make sure that the
nginx-module-vtsmodule is installed.N/A
Nginx host
The following types are supported:
-
The in-cluster access address of the Nginx service
-
The internal IP address of the cluster where the service resides
-
The public IPv4 address of the service
nginx-server.namespace
Nginx port
The port of the Nginx service.
80
Metric collection interval (seconds)
The metric collection interval. The default is 15 seconds.
15
ECS (VPC)
Parameter
Description
Example
Integration name (optional)
A custom name for the integration.
nginxtest321
Enable Nginx for stub status monitoring
Enables or disables this monitoring feature.
It provides statistics on Nginx requests and connections.
N/A
Enable Nginx for VTS monitoring
Enables or disables this monitoring feature.
This option uses the
nginx-module-vtsmodule, which typically requires manual compilation, to collect data. It provides metrics such as Nginx request counts, byte sizes, and response times.NoteBefore you enable this option, make sure that the
nginx-module-vtsmodule is installed.N/A
Nginx host
The following types are supported:
-
The in-cluster access address of the Nginx service
-
The internal IP address of the cluster where the service resides
-
The public IPv4 address of the service
nginx-server.namespace
Nginx port
The port of the Nginx service.
80
Metric collection interval (seconds)
The metric collection interval. The default is 15 seconds.
15
Custom Tags
Adds custom key-value pair tags to metrics collected by Prometheus, which allows for more granular organization, querying, monitoring, and analysis in tools such as Grafana. For more information, see Inject a custom tag into metrics for an instance in a VPC environment.
Note-
Tag keys cannot contain special characters such as hyphens (-), periods (.), or percent signs (%) because these characters have special meanings in Prometheus.
-
Injected tags must be in a valid key-value format that Prometheus allows.
test1:aaa
-
-
View monitoring information
To view integrated components, click Integration Management in the left-side navigation pane. Click an integration card to view its details, including targets, metrics, dashboards, alerts, service discovery configurations, and exporters. On the Self-monitoring page for the Kubernetes environment, select the Prometheus Agent tab. You can filter the data by using the job, instance, and agent drop-down lists. The page displays the following monitoring panels: Agent running status (expected replicas, running replicas, number of targets, and total series scraped); Agent discovery/scraping exceptions (number of job service discovery exceptions, job scraping exceptions, and target scraping exceptions; exceptions are highlighted in red); Agent configuration delivery exceptions (sendConfig exceptions and sendTargets exceptions; normal status is indicated in green); Agent collection and processing exceptions; and Agent running version. At the bottom, the Agent status overview table lists metrics for each agent, such as heartbeat, targets, series, writeArms, pod_name, memoryLimit, and cpuLim.