NGINX metrics

Collect metrics from NGINX

status: beta role: daemon role: sidecar delivery: at-least-once acknowledgements: no 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",
      "tls": null,
      "proxy": null,
      "auth": null
    }
  }
}
[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
    proxy: null
    auth: null

auth

optional object
Configures the authentication strategy.

auth.password

required string literal
The basic authentication password.
Examples
"${HTTP_PASSWORD}"
"password"

auth.strategy

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

auth.token

required string literal
The token to use for bearer authentication
Examples
"${API_TOKEN}"
"xyz123"

auth.user

required string literal
The basic authentication user name.
Examples
"${HTTP_USERNAME}"
"username"

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 literal
The namespace of metrics. Disabled if empty.
default: nginx

proxy

optional object
Configures an HTTP(S) proxy for Vector to use. By default, the globally configured proxy is used.

proxy.enabled

optional bool
If false the proxy will be disabled.
default: true

proxy.http

optional string literal
The URL to proxy HTTP requests through.
Examples
"http://foo.bar:3128"

proxy.https

optional string literal
The URL to proxy HTTPS requests through.
Examples
"http://foo.bar:3128"

proxy.no_proxy

optional [string]

A list of hosts to avoid proxying. Allowed patterns here include:

PatternExample match
Domain namesexample.com matches requests to example.com
Wildcard domains.example.com matches requests to example.com and its subdomains
IP addresses127.0.0.1 matches requests to 127.0.0.1
CIDR blocks192.168.0.0./16 matches requests to any IP addresses in this range
Splat* matches all hosts

scrape_interval_secs

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

tls

optional object
Configures the TLS options for incoming/outgoing connections.

tls.alpn_protocols

optional [string]

Sets the list of supported ALPN protocols.

Declare the supported ALPN protocols, which are used during negotiation with peer. Prioritized in the order they are defined.

tls.ca_file

optional string literal

Absolute path to an additional CA certificate file.

The certificate must be in the DER or PEM (X.509) format. Additionally, the certificate can be provided as an inline string in PEM format.

Examples
"/path/to/certificate_authority.crt"

tls.crt_file

common optional string literal

Absolute path to a certificate file used to identify this server.

The certificate must be in DER, PEM (X.509), or PKCS#12 format. Additionally, the certificate can be provided as an inline string in PEM format.

If this is set, and is not a PKCS#12 archive, key_file must also be set.

Examples
"/path/to/host_certificate.crt"

tls.key_file

common optional string literal

Absolute path to a private key file used to identify this server.

The key must be in DER or PEM (PKCS#8) format. Additionally, the key can be provided as an inline string in PEM format.

Examples
"/path/to/host_certificate.key"

tls.key_pass

optional string literal

Passphrase used to unlock the encrypted key file.

This has no effect unless key_file is set.

Examples
"${KEY_PASS_ENV_VAR}"
"PassWord1"

Enables certificate verification.

If enabled, certificates must be valid in terms of not being expired, as well as being issued by a trusted issuer. This verification operates in a hierarchical manner, checking that not only the leaf certificate (the certificate presented by the client/server) is valid, but also that the issuer of that certificate is valid, and so on until reaching a root certificate.

Relevant for both incoming and outgoing connections.

Do NOT set this to false unless you understand the risks of not verifying the validity of certificates.

default: true

tls.verify_hostname

optional bool

Enables hostname verification.

If enabled, the hostname used to connect to the remote host must be present in the TLS certificate presented by the remote host, either as the Common Name or as an entry in the Subject Alternative Name extension.

Only relevant for outgoing connections.

Do NOT set this to false unless you understand the risks of not verifying the remote hostname.

default: true

Environment variables

HTTPS_PROXY

common optional string literal

The global URL to proxy HTTPS requests through.

If another HTTPS proxy is set in the configuration file or at a component level, this one will be overridden.

The lowercase variant has priority over the uppercase one.

Examples
http://foo.bar:3128

HTTP_PROXY

common optional string literal

The global URL to proxy HTTP requests through.

If another HTTP proxy is set in the configuration file or at a component level, this one will be overridden.

The lowercase variant has priority over the uppercase one.

Examples
http://foo.bar:3128

NO_PROXY

common optional string literal

List of hosts to avoid proxying globally.

Allowed patterns here include:

PatternExample match
Domain namesexample.com matches requests to example.com
Wildcard domains.example.come matches requests to example.com and its subdomains
IP addresses127.0.0.1 matches requests to 127.0.0.1
CIDR blocks192.168.0.0./16 matches requests to any IP addresses in this range
Splat* matches all hosts

If another no_proxy value is set in the configuration file or at a component level, this one is overridden.

The lowercase variant has priority over the uppercase one.

Examples
localhost,.example.com,192.168.0.0./16
*

http_proxy

common optional string literal

The global URL to proxy HTTP requests through.

If another HTTP proxy is set in the configuration file or at a component level, this one will be overridden.

The lowercase variant has priority over the uppercase one.

Examples
http://foo.bar:3128

https_proxy

common optional string literal

The global URL to proxy HTTPS requests through.

If another HTTPS proxy is set in the configuration file or at a component level, this one will be overridden.

The lowercase variant has priority over the uppercase one.

Examples
http://foo.bar:3128

no_proxy

common optional string literal

List of hosts to avoid proxying globally.

Allowed patterns here include:

PatternExample match
Domain namesexample.com matches requests to example.com
Wildcard domains.example.come matches requests to example.com and its subdomains
IP addresses127.0.0.1 matches requests to 127.0.0.1
CIDR blocks192.168.0.0./16 matches requests to any IP addresses in this range
Splat* matches all hosts

If another no_proxy value is set in the configuration file or at a component level, this one is overridden.

The lowercase variant has priority over the uppercase one.

Examples
localhost,.example.com,192.168.0.0./16
*

Outputs

<component_id>

Default output stream of the component. Use this component’s ID as an input to downstream transforms and sinks.

Output Data

Metrics

connections_accepted_total

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

connections_active

gauge
The current number of active client connections including Waiting connections.
endpoint
Nginx endpoint.
host
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
Nginx endpoint.
host
The hostname of the Nginx server.

connections_reading

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

connections_waiting

gauge
The current number of idle client connections waiting for a request.
endpoint
Nginx endpoint.
host
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
Nginx endpoint.
host
The hostname of the Nginx server.

http_requests_total

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

up

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

Telemetry

Metrics

link

collect_completed_total

counter
The total number of metrics collections completed for this component.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

collect_duration_seconds

histogram
The duration spent collecting of metrics for this component.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

component_received_events_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use component_id instead. The value is the same as component_id.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

component_sent_event_bytes_total

counter
The total number of event bytes emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use component_id instead. The value is the same as component_id.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

component_sent_events_total

counter
The total number of events emitted by this component.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use component_id instead. The value is the same as component_id.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

events_in_total

counter
The number of events accepted by this component either from tagged origins like file and uri, or cumulatively from other origins. This metric is deprecated and will be removed in a future version. Use component_received_events_total instead.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use component_id instead. The value is the same as component_id.
component_type
The Vector component type.
container_name optional
The name of the container from which the data originated.
file optional
The file from which the data originated.
host optional
The hostname of the system Vector is running on.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the data originated.
peer_path optional
The pathname from which the data originated.
pid optional
The process ID of the Vector instance.
pod_name optional
The name of the pod from which the data originated.
uri optional
The sanitized URI from which the data originated.

events_out_total

counter
The total number of events emitted by this component. This metric is deprecated and will be removed in a future version. Use component_sent_events_total instead.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use component_id instead. The value is the same as component_id.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
output optional
The specific output of the component.
pid optional
The process ID of the Vector instance.

http_request_errors_total

counter
The total number of HTTP request errors for this component.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

parse_errors_total

counter
The total number of errors parsing metrics for this component.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

source_lag_time_seconds

histogram
The difference between the timestamp recorded in each event and the time when it was ingested, expressed as fractional seconds.
component_id
The Vector component ID.
component_kind
The Vector component kind.
component_name
Deprecated, use component_id instead. The value is the same as component_id.
component_type
The Vector component type.
host optional
The hostname of the system Vector is running on.
pid optional
The process ID of the Vector instance.

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 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.