NGINX metrics

Collect metrics from NGINX

status: beta role: daemon role: sidecar delivery: at-least-once egress: batch state: stateless output: metrics

Requirements

Module ngx_http_stub_status_module should be enabled.

Configuration

Example configurations

{
  "sources": {
    "my_source_id": {
      "type": "nginx_metrics",
      "endpoints": "http://localhost:8000/basic_status",
      "scrape_interval_secs": 15
    }
  }
}
[sources.my_source_id]
type = "nginx_metrics"
endpoints = "http://localhost:8000/basic_status"
scrape_interval_secs = 15
---
sources:
  my_source_id:
    type: nginx_metrics
    endpoints: http://localhost:8000/basic_status
    scrape_interval_secs: 15
{
  "sources": {
    "my_source_id": {
      "type": "nginx_metrics",
      "endpoints": "http://localhost:8000/basic_status",
      "scrape_interval_secs": 15,
      "namespace": "nginx"
    }
  }
}
[sources.my_source_id]
type = "nginx_metrics"
endpoints = "http://localhost:8000/basic_status"
scrape_interval_secs = 15
namespace = "nginx"
---
sources:
  my_source_id:
    type: nginx_metrics
    endpoints: http://localhost:8000/basic_status
    scrape_interval_secs: 15
    namespace: nginx
    tls: null
    auth: null

auth

optional object
Configures the authentication strategy.

auth.password

required string literal
The basic authentication password.

auth.strategy

required string enum literal
The authentication strategy to use.
Enum options
OptionDescription
basicThe basic authentication strategy.
bearerThe bearer token authentication strategy.

auth.token

required string literal
The token to use for bearer authentication

auth.user

required string literal
The basic authentication user name.

endpoints

required [string]
HTTP/HTTPS endpoint to Nginx server with enabled ngx_http_stub_status_module module.
Array string literal
Examples
[
  "http://localhost:8000/basic_status"
]

namespace

optional string
The namespace of metrics. Disabled if empty.
default: nginx

scrape_interval_secs

common optional uint
The interval between scrapes.
default: 15 (seconds)

tls

optional object
Configures the TLS options for incoming connections.

tls.ca_file

optional string literal
Absolute path to an additional CA certificate file, in DER or PEM format (X.509), or an inline CA certificate in PEM format.

tls.crt_file

optional string literal
Absolute path to a certificate file used to identify this connection, in DER or PEM format (X.509) or PKCS#12, or an inline certificate in PEM format. If this is set and is not a PKCS#12 archive, key_file must also be set.

tls.enabled

optional bool
Enable TLS during connections to the remote.
default: false

tls.key_file

optional string literal
Absolute path to a private key file used to identify this connection, in DER or PEM format (PKCS#8), or an inline private key in PEM format. If this is set, crt_file must also be set.

tls.key_pass

optional string literal
Pass phrase used to unlock the encrypted key file. This has no effect unless key_file is set.

tls.verify_certificate

optional bool
If true (the default), Vector will validate the TLS certificate of the remote host.
default: true

tls.verify_hostname

optional bool
If true (the default), Vector will validate the configured remote host name against the remote host’s TLS certificate. Do NOT set this to false unless you understand the risks of not verifying the remote hostname.
default: true

Output

Metrics

connections_accepted_total

counter
The total number of accepted client connections.
endpoint required
Nginx endpoint.
host required
The hostname of the Nginx server.

connections_active

gauge
The current number of active client connections including Waiting connections.
endpoint required
Nginx endpoint.
host required
The hostname of the Nginx server.

connections_handled_total

counter
The total number of handled connections. Generally, the parameter value is the same as accepts unless some resource limits have been reached (for example, the worker_connections limit).
endpoint required
Nginx endpoint.
host required
The hostname of the Nginx server.

connections_reading

gauge
The current number of connections where nginx is reading the request header.
endpoint required
Nginx endpoint.
host required
The hostname of the Nginx server.

connections_waiting

gauge
The current number of idle client connections waiting for a request.
endpoint required
Nginx endpoint.
host required
The hostname of the Nginx server.

connections_writing

gauge
The current number of connections where nginx is writing the response back to the client.
endpoint required
Nginx endpoint.
host required
The hostname of the Nginx server.

http_requests_total

counter
The total number of client requests.
endpoint required
Nginx endpoint.
host required
The hostname of the Nginx server.

up

gauge
If the Nginx server is up or not.
endpoint required
Nginx endpoint.
host required
The hostname of the Nginx server.

Telemetry

Metrics

link

collect_completed_total

counter
The total number of metrics collections completed for this component.

collect_duration_seconds

histogram
The duration spent collecting of metrics for this component.

events_in_total

counter
The number of events accepted by this component either from tagged origin like file and uri, or cumulatively from other origins.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.
container_name optional
The name of the container from which the event originates.
file optional
The file from which the event originates.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the event originates.
peer_path optional
The pathname from which the event originates.
pod_name optional
The name of the pod from which the event originates.
uri optional
The sanitized URI from which the event originates.

events_out_total

counter
The total number of events emitted by this component.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

http_request_errors_total

counter
The total number of HTTP request errors for this component.

parse_errors_total

counter
The total number of errors parsing metrics for this component.

How it works

Context

By default, the nginx_metrics source augments events with helpful context keys.

Module ngx_http_stub_status_module

The [ngx_http_stub_status_module]9http://nginx.org/en/docs/http/ngx_http_stub_status_module.html) module provides access to basic status information. Basic status information is a simple web page with text data.

State

This component is stateless, meaning its behavior is consistent across each input.