Monitor your NGINX Plus servers running on a host using the OpenTelemetry Collector to send metrics and telemetry data to New Relic.
This integration leverages the OpenTelemetry prometheusreceiver and nginx-prometheus-exporter to monitor your NGINX Plus performance metrics, connection statistics, and server health. The rich HTTP API in NGINX Plus provides significantly more detailed metrics compared to the basic stub status module in standard NGINX.
Expected output: HTTP/2 405 (method not allowed is expected)
Step 1: Configure NGINX Plus
Configure and enable the HTTP API module to expose metrics from your NGINX Plus server.
Add the HTTP API configuration to your nginx.conf file. Typically add this within the http block:
server{
listen8080;
server_name localhost;
location /api{
api write=on;
# Restrict access as needed
allow 127.0.0.1;
deny all;
}
}
After updating nginx.conf, test and reload the service:
bash
$
sudo nginx -t&&sudo nginx -s reload
Confirm the API endpoint path (including version) exposed in your configuration. Record the full API endpoint path (without the leading slash) and the port that serves it. Common defaults are api/9 on port 8080.
Use curl to confirm your API endpoint is reachable:
Write environment.conf with your OTLP endpoint. Replace YOUR_LICENSE_KEY with the New Relic license key and YOUR_OTLP_ENDPOINT with the appropriate endpoint for your region. Refer to the OTLP endpoint configuration documentation to select the right endpoint.
Extend your collector configuration to include access and error logs if you want log events alongside metrics.
Configure NGINX Plus log format
Before forwarding logs, configure NGINX Plus to use a structured log format. Refer to the NGINX logging documentation for guidance on configuring access and error logs.
Configure the OpenTelemetry Collector for log forwarding
Note the full paths to your NGINX access and error log files. Defaults are usually /var/log/nginx/access.log and /var/log/nginx/error.log.
Update /etc/otelcol-contrib/config.yaml to add a filelog receiver and log pipeline:
Select Dashboards, and click NGINX OTel overview dashboard.
In the popup window, select your account.
Click View dashboard, and see your NGINX Plus data in New Relic.
The NGINX Plus metrics are attached to the Metricevent type. You can query this data for troubleshooting purposes or to create custom charts and dashboards.
Metrics collected
The OpenTelemetry Collector scrapes metrics from the NGINX Prometheus exporter, which exposes NGINX Plus HTTP API metrics in Prometheus format.
Below are the available NGINX Plus metrics:
Metric
Description
Type
nginxplus_connections_accepted
Accepted client connections
Sum
nginxplus_connections_active
Active client connections
Gauge
nginxplus_connections_dropped
Dropped client connections
Sum
nginxplus_connections_idle
Idle client connections
Gauge
Metric
Description
Type
nginxplus_http_requests_total
Total http requests
Sum
nginxplus_http_requests_current
Current http requests
Gauge
Metric
Description
Type
nginxplus_ssl_handshakes
Successful SSL handshakes
Sum
nginxplus_ssl_handshakes_failed
Failed SSL handshakes
Sum
nginxplus_ssl_session_reuses
Session reuses during SSL handshake
Sum
Metric
Description
Type
nginxplus_server_zone_processing
Client requests that are currently being processed
Gauge
nginxplus_server_zone_requests
Total client requests
Sum
nginxplus_server_zone_responses
Total responses sent to clients
Sum
nginxplus_server_zone_responses_codes
Total responses sent to clients by code
Sum
nginxplus_server_zone_discarded
Requests completed without sending a response
Sum
nginxplus_server_zone_received
Bytes received from clients
Sum
nginxplus_server_zone_sent
Bytes sent to clients
Sum
nginxplus_server_ssl_handshakes
Successful SSL handshakes
Sum
nginxplus_server_ssl_handshakes_failed
Failed SSL handshakes
Sum
nginxplus_server_ssl_session_reuses
Session reuses during SSL handshake
Sum
Metric
Description
Type
nginxplus_location_zone_requests
Total client requests
Sum
nginxplus_location_zone_responses
Total responses sent to clients
Sum
nginxplus_location_zone_responses_codes
Total responses sent to clients by code
Sum
nginxplus_location_zone_discarded
Requests completed without sending a response
Sum
nginxplus_location_zone_received
Bytes received from clients
Sum
nginxplus_location_zone_sent
Bytes sent to clients
Sum
Metric
Description
Type
nginxplus_cache_size
Total size of the cache
Gauge
nginxplus_cache_max_size
Maximum size of the cache
Gauge
nginxplus_cache_cold
Is the cache considered cold
Gauge
nginxplus_cache_hit_responses
Total number of cache hits
Sum
nginxplus_cache_hit_bytes
Total number of bytes returned from cache hits
Sum
nginxplus_cache_stale_responses
Total number of stale cache hits
Sum
nginxplus_cache_stale_bytes
Total number of bytes returned from stale cache hits
Sum
nginxplus_cache_updating_responses
Total number of cache hits while cache is updating
Sum
nginxplus_cache_updating_bytes
Total number of bytes returned from cache while cache is updating
Sum
nginxplus_cache_revalidated_responses
Total number of cache revalidations
Sum
nginxplus_cache_revalidated_bytes
Total number of bytes returned from cache revalidations
Sum
nginxplus_cache_miss_responses
Total number of cache misses
Sum
nginxplus_cache_miss_bytes
Total number of bytes returned from cache misses
Sum
nginxplus_cache_expired_responses
Total number of cache hits with expired TTL
Sum
nginxplus_cache_expired_bytes
Total number of bytes returned from cache hits with expired TTL
Sum
nginxplus_cache_expired_responses_written
Total number of cache hits with expired TTL written to cache
Sum
nginxplus_cache_expired_bytes_written
Total number of bytes written to cache from cache hits with expired TTL
Sum
nginxplus_cache_bypass_responses
Total number of cache bypasses
Sum
nginxplus_cache_bypass_bytes
Total number of bytes returned from cache bypasses
Sum
nginxplus_cache_bypass_responses_written
Total number of cache bypasses written to cache
Sum
nginxplus_cache_bypass_bytes_written
Total number of bytes written to cache from cache bypasses
Sum
Attribute
Description
Example Values
server_zone
The name of the server zone (applies to HTTP Server Zones metrics)
example.com, api.example.com
code
HTTP response status code (applies to response metrics)
1xx, 2xx, 3xx, 4xx, 5xx, 200, 404, 500
location_zone
The name of the location zone
/api, /images, /static
cache
The name of the cache
my_cache, static_cache
nginx.server.endpoint
The NGINX Plus API endpoint URL
http://localhost:8080/api
nginx.deployment.name
A unique name to identify this NGINX Plus deployment
production-web-01, staging-api
nginx.display.name
A display-friendly name combining "server" prefix with deployment name
server:production-web-01
host.name
The hostname of the system where NGINX Plus is running
web-server-01.example.com
host.id
The unique identifier of the host system
i-1234567890abcdef0
logtype
The type of log being collected (applicable to logs only). Used by New Relic's built-in parsing rules. This attribute is only available when log forwarding is enabled.